Here you can find the source of round(float f, int n)
private static String round(float f, int n)
//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; } }