code: public static byte[] parseBinary(InputStream inputStream, final int size) throws IOException {
          byte value[] = new byte[size];
          int i = value.length;
          while (i != 0) {
              i -= inputStream.read(value, value.length - i, i);
          }
  
          return value;
      }
docs: method to parse byte array
  
  @param inputStream
  - stream to get value
  @param size
  - size of the value in bytes
  @return - parsed value as array of bytes
  @throws IOException
  - in case of IO error