Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- for (int i = n - 1; i >= 0; i--) {
- int power16 = (int) Math.pow(16, n - i - 1);
- //Convert input so that ABCDEF gets accounted for
- input = input.toUpperCase();
- String hex = "0123456789ABCDEF";
- //Convert the charAt to String
- String digit = input.charAt(i) + "";
- //Goes back to hex and finds the hex letter
- long newdigit = hex.indexOf(digit);
- // Multiply each digit by its respective power of two
- output += newdigit * power16;
Add Comment
Please, Sign In to add comment