edu.buffalo.fs7.mathlib
Class Easy

java.lang.Object
  |
  +--edu.buffalo.fs7.mathlib.Easy

public class Easy
extends java.lang.Object

Class providing number format capabilities. Author: Dr. Richard Gonsalves, SUNY Buffalo


Constructor Summary
Easy()
           
 
Method Summary
static java.lang.String format(double d, int precision)
          Formats a double with a specified number of digits.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Easy

public Easy()
Method Detail

format

public static java.lang.String format(double d,
                                      int precision)
Formats a double with a specified number of digits. When java converts a double to a String it retains the full precision of the number. This can generate 15 decimal places! This method truncates this output to some specified number of decimal places.
Parameters:
d - the double to format
precision - the number of digits desired
Returns:
returns the formatted string