/** * Java binary, octal, decimal, 16 binary conversion */public class APP {public static void Main (string[] args) { int i = 192; System.out.println ("---------------------------------"); System.out.println ("Decimal Turn binary:" + integer.tobinarystring (i)); System.out.println ("Decimal turn octal:" + integer.tooctalstring (i)); System.out.println ("Decimal to 16 binary:" + integer.tohexstring (i)); System.out.println ("---------------------------------"); SYSTEM.OUT.PRINTLN ("Binary goto decimal:" + integer.valueof ("11000000", 2). toString ()); System.out.println ("Octal to Decimal:" + integer.valueof ("8"). ToString ()); SYSTEM.OUT.PRINTLN ("Hexadecimal to decimal:" + integer.valueof ("C0", +). toString ()); System.out.println ("---------------------------------");} }
Output:
---------------------------------
Decimal Turn binary: 11000000
Decimal Turn octal: 300
Decimal to 16 binary: C0
---------------------------------
Binary to decimal: 192
Octal to decimal: 192
Hexadecimal to decimal: 192
---------------------------------
Java binary, octal, decimal, 16 binary conversion