code: public static byte[] encode(String s) throws UTFDataFormatException {
          int utfCount = (int) ModifiedUtf8.countBytes(s, true);
          byte[] result = new byte[SizeOf.SHORT + utfCount];
          Memory.pokeShort(result, 0, (short) utfCount, ByteOrder.BIG_ENDIAN);
          ModifiedUtf8.encode(result, SizeOf.SHORT, s);
          return result;
      }
docs: Returns an array containing the <i>modified UTF-8</i> form of {@code s}, using a
  big-endian 16-bit length. Throws UTFDataFormatException if {@code s} is too long
  for a two-byte length.