public class Main { public static void main(String[] argv) { System.out.println(byteToHex((byte) 123)); } public static String byteToHex(byte b) { int i = b & 0xFF; return Integer.toHexString(i); } } //7b