code: public byte[] toByteArray() {
          final int size = getSize();
  
          final ByteBuffer buff = ByteBuffer.allocate(size);
  
          // Add type byte
          buff.put(type.getValue());
  
          // add flags byte
          byte flagSRC = 0x00;
          for (AceFlag flag : getFlags()) {
              flagSRC |= flag.getValue();
          }
          buff.put(flagSRC);
  
          // add size bytes (2 reversed)
          byte[] sizeSRC = NumberFacility.getBytes(size);
          buff.put(sizeSRC[3]);
          buff.put(sizeSRC[2]);
  
          // add right mask
          buff.put(Hex.reverse(NumberFacility.getUIntBytes(rights.asUInt())));
  
          // add object flags (from int to byte[] + reversed)
          if (objectFlags != null) {
              buff.put(Hex.reverse(NumberFacility.getUIntBytes(objectFlags.asUInt())));
          }
  
          // add object type
          if (objectType != null) {
              buff.put(objectType);
          }
  
          // add inherited object type
          if (inheritedObjectType != null) {
              buff.put(inheritedObjectType);
          }
  
          // add sid
          buff.put(sid.toByteArray());
  
          // add application data
          if (applicationData != null) {
              buff.put(applicationData);
          }
  
          return buff.array();
      }
docs: Serializes to byte array.
  
  @return serialized ACE.