I have a device sending me their IP address in hexadecimal form through a udp packet. I want to print out that IP address in the form that it came in. FF FF FF FF for example.
But I'm not sure how to do that, and my code won't work because it just turns everything into the unreadable UTF-8 symbol.
byte[] ipAddr = {(byte)0xFF, (byte)0xFF, (byte)0xFF, (byte)0xFF};
String ipString = new String(ipAddr, StandardCharsets.UTF_8);
How can I change the code so that printing ipString gives "FF FF FF FF"?