Jhonny_V

Untitled

Dec 14th, 2020
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.67 KB | None | 0 0
  1.  
  2. public class Main {
  3.     public static void main(String[] args) {
  4.         String hexNum = "7DEDEDE1";
  5.         int decimalNum = Integer.parseInt(hexNum,16);
  6.  
  7.         String base2= Integer.toString(decimalNum,2);
  8.         String base8= Integer.toString(decimalNum,8);
  9.         String base10= Integer.toString(decimalNum,10);
  10.         String base16= Integer.toString(decimalNum,16);
  11.         String base36= Integer.toString(decimalNum,36);
  12.  
  13.         System.out.println("0b"+base2);
  14.         System.out.println("0"+base8);
  15.         System.out.println(decimalNum);
  16.         System.out.println("0x"+base16.toLowerCase());
  17.         System.out.println(base36.toUpperCase());
  18.     }
  19. }
Advertisement
Add Comment
Please, Sign In to add comment