Java Number Format Pattern getFormatTwoPoint(float param)

Here you can find the source of getFormatTwoPoint(float param)

Description

get Format Two Point

License

Open Source License

Declaration

public static float getFormatTwoPoint(float param) 

Method Source Code

//package com.java2s;

public class Main {

    public static float getFormatTwoPoint(float param) {
        param += 0.001;//from   w  w  w.ja v a 2 s. c o  m
        java.text.DecimalFormat df = new java.text.DecimalFormat("#0.00");
        return Float.parseFloat(df.format(param));
    }

    public static double getFormatTwoPoint(double param) {
        param += 0.001;
        java.text.DecimalFormat df = new java.text.DecimalFormat("#0.00");
        return Double.parseDouble(df.format(param));
    }
}

Related

  1. getFormattedString4Digits(String number, String pattern)
  2. getFormatter()
  3. getFormatter()
  4. getFormatter(int precision)
  5. getFormatter(String pattern)
  6. getFormatWithMinimumDecimals(final int minimumDecimals, final int maximumDecimals)
  7. getGeographicPositionFormatter()
  8. getIntegerFormat()
  9. getIntegerFormat(int maximumIntegerDigits)