This example code takes the help of Integer class and converts the integer to the octal and hexadecimal number.

Java Code:
public class HexaOctalExp {

	public static void main(String[] args) {
		int i = 74; 
		String hexString = Integer.toHexString( i ); 
		String octString = Integer.toOctalString( i );
		System.out.println("Hexa decimal conversion "+hexString);
		System.out.println("Octal coversion "+octString);

	}

}