code: public static byte[] getBytes(final String mValue) {
          byte[] bytes = null;
          try {
              if (mValue == null || mValue.length() == 0) {
                  bytes = new byte[0];
              } else {
                  final StringBuilder builder = new StringBuilder();
                  for (int i = 0; i < mValue.length(); i++) {
                      switch (mValue.charAt(i)) {
                      case '&':
                          builder.append("&amp;");
                          break;
                      case '<':
                          builder.append("&lt;");
                          break;
                      default:
                          builder.append(mValue.charAt(i));
                      }
                  }
                  bytes = builder.toString().getBytes("UTF-8");
  
                  // bytes = value.replace("&", "&amp;").replace("<", "&lt;")
                  // .getBytes(ConstructorProps.DEFAULT_ENCODING);
              }
          } catch (final Exception e) {
              throw new RuntimeException("Could not convert String to byte[]: " + e.getLocalizedMessage());
          }
          return bytes;
      }
docs: Get UTF-8 byte array from string. The given byte array yields a int if
  read with parseInt().
  
  @param mValue
  String to encode as UTF-8 byte array.
  @return UTF-8-encoded byte array of string.