Code example for NumberFormat

Methods: setMaximumFractionDigitssetMinimumFractionDigits

        this.hourFormatter = NumberFormat.getNumberInstance();
        this.hourSuffix = "h";
        this.minuteFormatter = NumberFormat.getNumberInstance();
        this.minuteSuffix = "m";
        this.secondFormatter = NumberFormat.getNumberInstance();
        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. 
Experience pair programming with AI  Get Codota for Java