code: public static byte[] changeEncoding(byte[] input, String oldEncoding, String newEncoding) {
  
          if ((oldEncoding == null) || (newEncoding == null)) {
              return input;
          }
          if (oldEncoding.trim().equalsIgnoreCase(newEncoding.trim())) {
              return input;
          }
          byte[] result = input;
          try {
              result = (new String(input, oldEncoding)).getBytes(newEncoding);
          } catch (UnsupportedEncodingException e) {
              // return value will be input value
          }
          return result;
      }
docs: Changes the encoding of a byte array that represents a String.<p>
  
  @param input the byte array to convert
  @param oldEncoding the current encoding of the byte array
  @param newEncoding the new encoding of the byte array
  
  @return the byte array encoded in the new encoding