Here you can find the source of base64UrlFriendly(String base)
public static String base64UrlFriendly(String base)
//package com.java2s; //License from project: Open Source License import java.util.Base64; public class Main { public static String base64UrlFriendly(String base) { return base.replace("+", "-").replace("/", "_").replace("=", ""); }/*from ww w. j a v a 2s . co m*/ public static String base64UrlFriendly(byte[] buff) { return base64UrlFriendly(base64(buff)); } public static String base64(byte[] buff) { return new String(Base64.getEncoder().encode(buff)); //return DatatypeConverter.printBase64Binary(buff); } }