1 public class Reverse {2 3 public static void main (String [] args) {4 System.out.println(toHexString(34));5 }6 7 public static String toHexString(int i) {8 StringBuffer buf = new StringBuffer (8);9 do {10 buf.append(Character.forDigit(i & 0xF, 16));11 i >>>= 4;12 } while (i != 0);13 return buf.reverse().toString();14 }15 }16