Here you can find the source of roundDec(float num, int dec)
private static float roundDec(float num, int dec)
//package com.java2s; //License from project: Open Source License public class Main { private static float roundDec(float num, int dec) { return (float) Math.round(num * (10 ^ dec)) / (10 ^ dec); }/*from w w w . j ava2s. c o m*/ }