code: private final void round(int maximumDigits) {
          // Eliminate digits beyond maximum digits to be displayed.
          // Round up if appropriate.
          if (maximumDigits >= 0 && maximumDigits < count) {
              if (shouldRoundUp(maximumDigits)) {
                  // Rounding up involved incrementing digits from LSD to MSD.
                  // In most cases this is simple, but in a worst case situation
                  // (9999..99) we have to adjust the decimalAt value.
                  for (;;) {
                      --maximumDigits;
                      if (maximumDigits < 0) {
                          // We have all 9's, so we increment to a single digit
                          // of one and adjust the exponent.
                          digits[0] = '1';
                          ++decimalAt;
                          maximumDigits = 0; // Adjust the count
                          break;
                      }
  
                      ++digits[maximumDigits];
                      if (digits[maximumDigits] <= '9') break;
                      // digits[maximumDigits] = '0'; // Unnecessary since we'll truncate this
                  }
                  ++maximumDigits; // Increment for use as count
              }
              count = maximumDigits;
  
              // Eliminate trailing zeros.
              while (count > 1 && digits[count-1] == '0') {
                  --count;
              }
          }
      }
docs: Round the representation to the given number of digits.
  @param maximumDigits The maximum number of digits to be shown.
  Upon return, count will be less than or equal to maximumDigits.