Here you can find the source of floor(double a, int n)
public static double floor(double a, int n)
//package com.java2s; //License from project: Open Source License public class Main { public static double floor(double a, int n) { double p = Math.pow(10.0, n); return Math.floor((a * p) + 0.5) / p; }//from w w w . j ava 2 s . c o m }