Java Fraction Format formatFloat(double val1, double val2)

Here you can find the source of formatFloat(double val1, double val2)

Description

format Float

License

Open Source License

Declaration

public static float formatFloat(double val1, double val2) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

import java.text.DecimalFormat;

public class Main {
    public static final DecimalFormat floatFormatter = new DecimalFormat("#.00");

    public static float formatFloat(double val1, double val2) {
        return val2 == 0 ? 0 : Float.parseFloat(floatFormatter.format(val1 / val2));
    }//from   ww  w  .j a  va2  s .  co  m
}

Related

  1. formatDoubleDecPoint2(Double value)
  2. formatDoubleList(List list)
  3. formatDoubleString(double data, String pattern)
  4. formatDoubleValue(String originalVal, Double valToProcess)
  5. formateNum(double num)
  6. formatFloat(float f, String format)
  7. formatFloat(float num)
  8. formatFloat(float number)
  9. formatFloat(float number, int numberOfAfterDot)