Java Fraction Format formatCPUUtilization(double d)

Here you can find the source of formatCPUUtilization(double d)

Description

format CPU Utilization

License

Open Source License

Declaration

public static String formatCPUUtilization(double d) 

Method Source Code

//package com.java2s;
/*/*from  w  ww  . j a v a 2  s . c o m*/
 * Copyright (c) Fiorano Software and affiliates. All rights reserved. http://www.fiorano.com
 * The software in this package is published under the terms of the CPAL v1.0
 * license, a copy of which has been included with this distribution in the
 * LICENSE.txt file.
 */

import java.text.DecimalFormat;

public class Main {
    public static String formatCPUUtilization(double d) {
        DecimalFormat decimalFormat = new DecimalFormat("0.00");
        if (d < 0) {
            return "NA";
        } else {
            return decimalFormat.format(d * 100).replace(",", ".");
        }
    }
}

Related

  1. formatAvgTime(double avg)
  2. formatBet(Double betOdd, int formatterDigits)
  3. formatBetHandicap(Double handicap)
  4. formatBytes(final double bytes)
  5. formatCoordinates(double lat, double lon)
  6. formatD(double d)
  7. formatData(double aAmount)
  8. formatDataValue(double value)
  9. formatDecimal(double dtSource, String nbit)