code: public static String bytes2String(byte[] bytes) {
      try {
        final int len = bytes.length;
        char[] charArray = UTF8.getCharArray(len);
        for (int i = 0; i < bytes.length; i++) {
          if (bytes[i] < UTF8.MIN_ASCII_CODE) {
            // non-ASCII codepoints' higher bytes
            // are of the form (10xxxxxx), hence the bytes
            // represent a non-ASCII string
            // do expensive conversion
            return new String(bytes, utf8charsetName);
          }
          // copy to temporary array
          charArray[i] = (char) bytes[i];
        }
        // only ASCII bytes, do fast conversion
        // using bytes as actual characters
        return new String(charArray, 0, len);
      } catch (UnsupportedEncodingException e) {
        assert false : "UTF8 encoding is not supported ";
      }
      return null;
    }
docs: Converts a byte array to a string using UTF8 encoding.