Here you can find the source of floor(double num, int bit)
public static double floor(double num, int bit)
//package com.java2s; //License from project: Open Source License public class Main { public static double floor(double num, int bit) { int t = 1; for (int i = 0; i < bit; i++) t *= 10;// w w w . j a va 2 s . co m int n = (int) (num * t); return (double) n / t; } public static double floor(double num) { return floor(num, 0); } }