Java Float Number Round round(float f, int n)

Here you can find the source of round(float f, int n)

Description

round

License

Open Source License

Declaration

private static String round(float f, int n) 

Method Source Code

//package com.java2s;
/*// ww  w  .ja v  a  2  s.c  om
 * Copyright (C) ${year} Omry Yadan <${email}>
 * All rights reserved.
 *
 * See https://github.com/omry/banana/blob/master/BSD-LICENSE for licensing information
 */

public class Main {
    private static String round(float f, int n) {
        int d = (int) Math.pow(10, n);
        return "" + ((int) (f * d)) / (float) d;
    }
}

Related

  1. round(float amount, int cent)
  2. round(float axisValue)
  3. round(float d)
  4. round(float f, int dp)
  5. round(float f, int i)
  6. round(float input)
  7. round(float input)
  8. round(float number, int fractionalPartSize)
  9. round(float pX)