Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class Main {
- public static void main(String[] args) {
- String hexNum = "7DEDEDE1";
- int decimalNum = Integer.parseInt(hexNum,16);
- String base2= Integer.toString(decimalNum,2);
- String base8= Integer.toString(decimalNum,8);
- String base10= Integer.toString(decimalNum,10);
- String base16= Integer.toString(decimalNum,16);
- String base36= Integer.toString(decimalNum,36);
- System.out.println("0b"+base2);
- System.out.println("0"+base8);
- System.out.println(decimalNum);
- System.out.println("0x"+base16.toLowerCase());
- System.out.println(base36.toUpperCase());
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment