code: public static String bin2str(final byte[] values, final JBBPBitOrder bitOrder, final boolean separateBytes) {
      if (values == null) {
        return null;
      }
  
      final StringBuilder result = new StringBuilder(values.length * (separateBytes ? 9 : 8));
  
      boolean nofirst = false;
      for (final byte b : values) {
        if (separateBytes) {
          if (nofirst) {
            result.append(' ');
          } else {
            nofirst = true;
          }
        }
  
        int a = b;
  
        if (bitOrder == JBBPBitOrder.MSB0) {
          for (int i = 0; i < 8; i++) {
            result.append((a & 0x1) == 0 ? '0' : '1');
            a >>= 1;
          }
        } else {
          for (int i = 0; i < 8; i++) {
            result.append((a & 0x80) == 0 ? '0' : '1');
            a <<= 1;
          }
        }
      }
  
      return result.toString();
    }
docs: Convert a byte array into string binary representation with defined bit
  order and possibility to separate bytes.
  
  @param values        a byte array to be converted
  @param bitOrder      the bit order for byte decoding
  @param separateBytes if true then bytes will be separated by spaces
  @return the string representation of the array