Here you can find the source of roundUp(double val)
public static double roundUp(double val)
//package com.java2s; //License from project: Open Source License public class Main { public static double roundUp(double val) { int exponent = (int) Math.floor(Math.log10(val)); val *= Math.pow(10, -exponent); if (val > 5.0) val = 10.0; else if (val > 2.0) val = 5.0; else if (val > 1.0) val = 2.0; val *= Math.pow(10, exponent); return val; }//w ww .ja v a 2 s . co m }