Converting an integer to a hexadecimal (hex), octal or binary representation

Three useful functions in the Integer class do exactly this. Following program
demonstrates the use. Notice that the method toHexString returns the hexadecimal
representation in lowercase!

public class Main
{
   public static void main(String args[]) {
      int intValue = 65443;
 
      String hexValue = Integer.toHexString(intValue);
      String octValue = Integer.toOctalString(intValue);
      String binValue = Integer.toBinaryString(intValue);
 
      System.out.println(hexValue.toUpperCase());
      System.out.println(octValue);
      System.out.println(binValue);
   }
}

outputs:

FFA3
177643
1111111110100011