Created
November 17, 2016 11:15
-
-
Save jpwsutton/6d0607cc849f480f25d1f51fddecbf4a to your computer and use it in GitHub Desktop.
Prints a byte array in binary, hex and dec.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private void printByteArray(byte[] bytes){ | |
for (byte b1 : bytes){ | |
String s1 = String.format("%8s", Integer.toBinaryString(b1 & 0xFF)).replace(' ', '0'); | |
s1 += " " + Integer.toHexString(b1); | |
s1 += " " + b1; | |
System.out.println(s1); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment