code: public static String asString(byte[] bytes, Charset charset)
      {
          if (bytes == null)
          {
              return null;
          }
  
          if (charset == null)
          {
              throw new IllegalArgumentException("Cannot get bytes without a Charset");
          }
  
          try
          {
              return new String(bytes, charset.name());
          }
          catch (UnsupportedEncodingException e)
          {
              throw new IllegalStateException(charset.name() + " must be present", e);
          }
      }
docs: Turns a byte[] array into a string in the provided {@link Charset}
  
  @param bytes
  @param charset
  @return a String