Class SimpleByteArrayPrinter

java.lang.Object
com.reve.utils.bytearray.SimpleByteArrayPrinter

public class SimpleByteArrayPrinter extends Object
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 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 printed
      offset - starting index of the byte array
      length - length of the byte array you wanna print from starting index
      bytesInSingleLine - 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 printed
      offset - starting index of the byte array
      length - length of the byte array you wanna print from starting index
      spaceBetween - how many binary formed bytes I want in single line
      bytesInSingleLine - 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

      public static void main(String[] args)