code: public static byte[] getBytes(String string, String encoding) {
          try {
              return string.getBytes(encoding);
          } catch(UnsupportedEncodingException e) {
              throw new IllegalArgumentException(encoding + " is not a known encoding name.", e);
          }
      }
docs: Translate the string to bytes using the given encoding
  
  @param string The string to translate
  @param encoding The encoding to use
  @return The bytes that make up the string