code: public static byte[] getBytesUtf8(String string) {
      if (string == null) {
        return null;
      }
      return string.getBytes(StandardCharsets.UTF_8);
    }
docs: Encodes the given string into a sequence of bytes using the UTF-8 charset, storing the result
  into a new byte array.
  
  @param string the String to encode, may be <code>null</code>
  @return encoded bytes, or <code>null</code> if the input string was <code>null</code>
  @throws IllegalStateException Thrown when the charset is missing, which should be never
  according the the Java specification.
  @see <a href="http://download.oracle.com/javase/7/docs/api/java/nio/charset/Charset.html"
  >Standard charsets</a>
  @since 1.8