Java Fraction Format formatAvgTime(double avg)

Here you can find the source of formatAvgTime(double avg)

Description

format Avg Time

License

Apache License

Declaration

public static double formatAvgTime(double avg) 

Method Source Code


//package com.java2s;
//License from project: Apache License 

import java.text.DecimalFormat;

public class Main {
    public static double formatAvgTime(double avg) {
        // System.out.println("avg:" + avg + " totalMilliSeconds:" +
        // totalMilliSeconds + " totalCount:" + totalCount);
        String avgTime;//from  www .j ava  2 s.c om
        if (avg < 0.01) {
            avgTime = new DecimalFormat(",000").format(avg);
        } else if (avg < 0.1) {
            avgTime = new DecimalFormat(",00").format(avg);
        } else {
            avgTime = new DecimalFormat(".").format(avg);
        }
        // String avgTime = new DecimalFormat(",###").format(avg); NumberUtil.format(avg, n);
        return Double.parseDouble(avgTime);
    }
}

Related

  1. formatAmount(Double amount)
  2. formatAmount(double number)
  3. formatAmount(final double mark)
  4. formatAnotherString(double valor)
  5. formataNum(double numero)
  6. formatBet(Double betOdd, int formatterDigits)
  7. formatBetHandicap(Double handicap)
  8. formatBytes(final double bytes)
  9. formatCoordinates(double lat, double lon)