Non-decimal radices/Output: Difference between revisions

m
→‎{{header|Java}}: Added loop to be more like other examples
(added common lisp)
m (→‎{{header|Java}}: Added loop to be more like other examples)
Line 59:
=={{header|Java}}==
<lang java5>public static void main(String args[]){
for(int a= 0;a < 33;a++){
System.out.println(Integer.toHexStringtoBinaryString(a));
//assign a to a value at some point
System.out.println(Integer.toBinaryStringtoOctalString(a));
System.out.println(Integer.toOctalStringtoHexString(a));
// the above methods treat the integer as unsigned
System.out.println(Integer.toHexString(a));
// there are also corresponding Long.to***String() methods for long's.
// the above methods treat the integer as unsigned
// there are also corresponding Long.to***String() methods for long's.
 
System.out.printf("%3o %2d %2x\n",a ,a ,a); // printf like the other languages; binary not supported
}
}</lang>
 
Anonymous user