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