Saturday, January 4, 2014

integer ----> decimal, binary, octal, hexadecimal printing

// integer decimal, binary, octal, hexadecimal printing
int n=245;
String st1,st2,st3,st4;
st1=""+n;
st2=Integer.toBinaryString(n);
st3=Integer.toOctalString(n);
st4=Integer.toHexString(n);
System.out.println(st1);
System.out.println(st2);
System.out.println(st3);
System.out.println(st4);

No comments:

Post a Comment