Here you can find the source of base64Append(StringBuilder sb, int digit, boolean haveNonZero)
private static boolean base64Append(StringBuilder sb, int digit, boolean haveNonZero)
//package com.java2s; //License from project: Apache License public class Main { private static boolean base64Append(StringBuilder sb, int digit, boolean haveNonZero) { if (digit > 0) { haveNonZero = true;// w w w . j a v a2s. c o m } if (haveNonZero) { int c; if (digit < 26) { c = 'A' + digit; } else if (digit < 52) { c = 'a' + digit - 26; } else if (digit < 62) { c = '0' + digit - 52; } else if (digit == 62) { c = '$'; } else { c = '_'; } sb.append((char) c); } return haveNonZero; } }