Java Double Number Format format(final double power)

Here you can find the source of format(final double power)

Description

format

License

Open Source License

Return

Format result with 0 decimal places for bytes, or 1 for larger values

Declaration

public static String format(final double power) 

Method Source Code

//package com.java2s;

public class Main {
    /**//w w w.j  av  a  2 s .c  o m
     * @return Format result with 0 decimal places for bytes, or 1 for larger values
     */
    public static String format(final double power) {
        return power == 0 ? "%.0f%s" : "%.1f%s";
    }
}

Related

  1. format(double number, int precision)
  2. format(double size, String type)
  3. format(double val, int n, int w)
  4. format(double value, int decimalPlaces)
  5. format(double value, int digits)
  6. formatDouble(double d)
  7. formatDouble(double d)
  8. formatDouble(double d)
  9. formatDouble(double d, int n)