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