Here you can find the source of roundToNearestPowerOfTen(double value)
public static double roundToNearestPowerOfTen(double value)
//package com.java2s; //License from project: LGPL public class Main { /**/* ww w . j a v a2 s.co m*/ * Round down input value to nearest value of 10. e.g. 323 returns 100. */ public static double roundToNearestPowerOfTen(double value) { return Math.pow(10, Math.floor(log10(value))); } /** * Calculates log base 10 of the specified value. */ public static double log10(double value) { return Math.log(value) / Math.log(10); } }