public static String encode(String input){
  return Base64.encodeBase64String(input.getBytes(StandardCharsets.UTF_8));
}

public static String encode ( String input ) { return Base64 . encodeBase64String ( input . getBytes ( StandardCharsets . UTF_8 ) ) ; }
encode string to base64 string
