Code example for NumberFormat

Methods: setMaximumFractionDigitssetMinimumFractionDigits

0
        this.hourFormatter = NumberFormat.getNumberInstance();
        this.hourSuffix = "h";
        this.minuteFormatter = NumberFormat.getNumberInstance();
        this.minuteSuffix = "m";
        this.secondFormatter = NumberFormat.getNumberInstance();
        this.secondFormatter.setMaximumFractionDigits(3);
        this.secondFormatter.setMinimumFractionDigits(3);
        this.secondSuffix = "s";
 
        // we don't use the calendar or numberFormat fields, but equals(Object) 
        // is failing without them being non-null 
        this.calendar = new GregorianCalendar();
        this.numberFormat = new DecimalFormat("0");
    } 
 
    /** 
     * Returns the base date/time used to calculate the elapsed time for 
     * display. 
     * 
     * @return The base date/time in milliseconds since 1-Jan-1970. 
     *