Package com.reve.utils.bytearray
Class SimpleByteArrayPrinter
java.lang.Object
com.reve.utils.bytearray.SimpleByteArrayPrinter
Sample :
bytes = [
00000000 00000001 00000010 00000011
00000100 00000101
]
bytes = [
0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7
+-+-+-+-+-+-+-+-+ +-+-+-+-+-+-+-+-+ +-+-+-+-+-+-+-+-+ +-+-+-+-+-+-+-+-+
|0|0|0|0|0|0|0|0| |0|0|0|0|0|0|0|1| |0|0|0|0|0|0|1|0| |0|0|0|0|0|0|1|1|
+-+-+-+-+-+-+-+-+ +-+-+-+-+-+-+-+-+ +-+-+-+-+-+-+-+-+ +-+-+-+-+-+-+-+-+
0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7
+-+-+-+-+-+-+-+-+ +-+-+-+-+-+-+-+-+
|0|0|0|0|0|1|0|0| |0|0|0|0|0|1|0|1|
+-+-+-+-+-+-+-+-+ +-+-+-+-+-+-+-+-+
]
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidstatic StringprintByteArray(byte[] bytes, int offset, int length, int spaceBetween, int bytesInSingleLine) print a byte array in binary form from offset index to offset+length indexstatic StringprintByteArrayBeautifully(byte[] bytes, int offset, int length, int spaceBetween, int bytesInSingleLine) print a byte array beautifully in binary form from offset index to offset+length indexstatic StringprintHexArray(byte[] bytes, int offset, int length, int spaceBetween, int bytesInSingleLine)
-
Constructor Details
-
SimpleByteArrayPrinter
public SimpleByteArrayPrinter()
-
-
Method Details
-
printByteArray
public static String printByteArray(byte[] bytes, int offset, int length, int spaceBetween, int bytesInSingleLine) print a byte array in binary form from offset index to offset+length index- Parameters:
bytes- byte array to be printedoffset- starting index of the byte arraylength- length of the byte array you wanna print from starting indexbytesInSingleLine- how many binary formed bytes I want in single line- Returns:
- a String containing bytes in binary form , fixed number of bytes in single line
-
printHexArray
public static String printHexArray(byte[] bytes, int offset, int length, int spaceBetween, int bytesInSingleLine) -
printByteArrayBeautifully
public static String printByteArrayBeautifully(byte[] bytes, int offset, int length, int spaceBetween, int bytesInSingleLine) print a byte array beautifully in binary form from offset index to offset+length index- Parameters:
bytes- byte array to be printedoffset- starting index of the byte arraylength- length of the byte array you wanna print from starting indexspaceBetween- how many binary formed bytes I want in single linebytesInSingleLine- how many binary formed bytes I want in single line- Returns:
- a String containing bytes in binary form , fixed number of bytes in single line
-
main
-