Here you can find the source of ceil2(double d, int p)
public static double ceil2(double d, int p)
//package com.java2s; //License from project: Apache License public class Main { public static double ceil2(double d, int p) { long tmp = (long) Math.pow(10, p); double num = Math.ceil(d / tmp); num *= tmp;/*from w w w. jav a 2s . c o m*/ return num; } public static double ceil(double d, int p) { long tmp = (long) Math.pow(10, p); double num = Math.ceil(d * tmp); num /= tmp; return num; } }