code: public byte[] getBytes() {
          try {
              ByteArrayOutputStream stream = new ByteArrayOutputStream();
  
              stream.write(DATABASE_V2_FILE_SIGNATURE_1);
              stream.write(DATABASE_V2_FILE_SIGNATURE_2);
              stream.write(DATABASE_V2_FILE_VERSION);
  
              for (int i = 2; i < 11; i++) {
                  byte[] headerValue = getValue(i);
  
                  // Write index
                  stream.write(i);
  
                  // Write length
                  byte[] length = new byte[] { (byte) headerValue.length, 0 };
                  stream.write(length);
  
                  // Write value
                  stream.write(headerValue);
              }
  
              // Write terminating flag
              stream.write(getEndOfHeader());
  
              return stream.toByteArray();
          } catch (IOException e) {
              throw new KeePassHeaderUnreadableException("Could not write header value to stream", e);
          }
      }
docs: Returns the whole header as byte array.
  
  @return header as byte array