Presents your JAVA E-NEWSLETTER for January 9, 2003 <-------------------------------------------> MASTER MATHEMATICS WITH JAVA.LANG.MATH Before creating your own simple mathematic functions, be aware that they may already exist in the java.lang.Math class. While Math is an obvious place to find such painful-to-code functions as sine, cosine, tangent, logarithm, and square root, it also contains many easy to implement functions. One such function is the Math.abs(int) function. Given a number, it will return the absolute value for that number. Math.abs is overloaded for integer, float, double, and long. One set of commonly used functions are max and min. Given two numbers, the Math.min function will return the lower of the two, and the Math.max function will return the higher. Another set of common functions is made up of ceiling, floor, and round. These functions are used to turn a decimal number into an integer number; that is, the functions lose the part after the decimal point. Floor will return the integer part, ceiling returns the integer part + 1, and round adds on one if the decimal part is above 0.5. The toDegrees and toRadians functions were added in JDK 1.2 and perform the simple task of converting an angle measured in degrees into an angle measured in radians, and vice versa. Rather than doing mathematical functions, use java.lang.Math. It might save development time, save debugging time, and decrease the size of your project. ----------------------------------------