This week only. Pastebin PRO Accounts Christmas Special! Don't miss out!Want more features on Pastebin? Sign Up, it's FREE!
Guest

Function to truncate too much decimals

By: a guest on Jul 20th, 2013  |  syntax: Java  |  size: 0.16 KB  |  views: 83  |  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. }
clone this paste RAW Paste Data