Pastebin launched a little side project called HostCabi.net, check it out ;-)Don't like ads? PRO users don't see any ads ;-)
Guest

Function to truncate too much decimals

By: a guest on Jul 20th, 2013  |  syntax: Java  |  size: 0.16 KB  |  hits: 62  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. static public double truncateDecimals(double n, int numberOfDecimals){
  2.        return Math.floor(n*Math.pow(10,numberOfDecimals))/Math.pow(10, numberOfDecimals);
  3. }