code: private static char digitToBasic(int digit, boolean uppercase) {
          /*  0..25 map to ASCII a..z or A..Z */
          /* 26..35 map to ASCII 0..9         */
          if(digit<26) {
              if(uppercase) {
                  return (char)(CAPITAL_A+digit);
              } else {
                  return (char)(SMALL_A+digit);
              }
          } else {
              return (char)((ZERO-26)+digit);
          }
      }
docs: digitToBasic() returns the basic code point whose value
  (when used for representing integers) is d, which must be in the
  range 0 to BASE-1. The lowercase form is used unless the uppercase flag is
  nonzero, in which case the uppercase form is used.