code: private String stringForBig(BigInteger big, int sigchars, boolean remainder)
      {
          char[] chars = new char[sigchars + (remainder ? 1 : 0)];
          if (remainder)
              // remaining bit is the most significant in the last char
              chars[sigchars] |= 0x8000;
          for (int i = 0; i < sigchars; i++)
          {
              int maskpos = 16 * (sigchars - (i + 1));
              // apply bitmask and get char value
              chars[i] = (char)(big.and(CHAR_MASK.shiftLeft(maskpos)).shiftRight(maskpos).intValue() & 0xFFFF);
          }
          return new String(chars);
      }
docs: Convert a (positive) BigInteger into a String.
  If remainder is true, an additional char with the high order bit enabled
  will be added to the end of the String.