jill/src/main/java/io/github/agentsoz/jill/util/AString.java
public static byte[] toBytes(String str) {
    if (str == null) {
      return new byte[0];
    }
    byte[] val = null;
    try {
      val = str.getBytes(CHARSET);
    } catch (UnsupportedEncodingException e) { // NOPMD - ignore empty catch
      // Can never occur since CHARSET is correct and final
    }
    return val;
  }
public static byte[] toBytes(String str) {
    if (str == null) {
      return new byte[0];
    }
    byte[] val = null;
    try {
      val = str.getBytes(CHARSET);
    } catch (UnsupportedEncodingException e) { // NOPMD - ignore empty catch
      // Can never occur since CHARSET is correct and final
    }
    return val;
  }
Encodes the String str into a sequence of bytes using the character set specified in CHARSET,
storing the result into a new byte array.

@param str the String to convert from
@return the new byte array, or null if conversion was unsuccessful
@see String#getBytes(String)