h3.Math & Number Operations Code Samples
Learn how to use numbers and math operations in applications written in the Java programming language.
* [BasicMathDemo.java|http://java.sun.com/docs/books/tutorial/java/data/examples/BasicMathDemo.java] illustrates how to get the absolute value, ceiling value, floor value, and relative integer value. For supporting information see [The Java Tutorial: Object Basics and Simple Data Objects|http://java.sun.com/docs/books/tutorial/java/data/index.html].
* [DecimalFormatDemo.java|http://java.sun.com/docs/books/tutorial/java/data/examples/DecimalFormatDemo.java] formats decimal numbers into strings. For supporting information see [The Java Tutorial: Object Basics and Simple Data Objects|http://java.sun.com/docs/books/tutorial/java/data/index.html].
* [ExponentialDemo.java|http://java.sun.com/docs/books/tutorial/java/data/examples/ExponentialDemo.java] displays the exponent value and calls the exp, log, pow, and sqrt methods on it. For supporting information see [The Java Tutorial: Object Basics and Simple Data Objects|http://java.sun.com/docs/books/tutorial/java/data/index.html].
* [MinDemo.java|http://java.sun.com/docs/books/tutorial/java/data/examples/MinDemo.java] finds the smaller of two values. For supporting information see [The Java Tutorial: Object Basics and Simple Data Objects|http://java.sun.com/docs/books/tutorial/java/data/index.html].
* [NumberDemo.java|http://java.sun.com/docs/books/tutorial/java/data/examples/NumberDemo.java] creates two Float objects and one Double object. For supporting information see [The Java Tutorial: Object Basics and Simple Data Objects|http://java.sun.com/docs/books/tutorial/java/data/index.html].
* [Numbers.java|http://java.sun.com/new2java/supplements/2001/Numbers.java] shows you how to perform various math operations on numbers received from the command line. For supporting information see [New to Java Programming Supplement, October 2001|http://java.sun.com/new2java/supplements/2001/oct01.html].
* RandomBagDemo.java generates random numbers. For supporting information see [The Java Tutorial: Object Basics and Simple Data Objects|http://java.sun.com/docs/books/tutorial/java/data/index.html].
* [ScoresAverage.java|http://java.sun.com/new2java/supplements/2001/ScoresAverage.java] shows you how to store numbers in an array and compute the average. For supporting information see [New to Java Programming Supplement, August 2001|http://java.sun.com/new2java/supplements/2001/july.html].
* [ToStringDemo.java|http://java.sun.com/docs/books/tutorial/java/data/examples/ToStringDemo.java] uses the toString method to convert a number to a string, and uses some string methods to compute the number of digits before and after the decimal point. For supporting information see [The Java Tutorial: Object Basics and Simple Data Objects|http://java.sun.com/docs/books/tutorial/java/data/index.html].
* [TrigonometricDemo.java|http://java.sun.com/docs/books/tutorial/java/data/examples/TrigonometricDemo.java] computes various trigonometric values for a 45-degree angle. For supporting information see [The Java Tutorial: Object Basics and Simple Data Objects|http://java.sun.com/docs/books/tutorial/java/data/index.html].
* [ValueOfDemo.java|http://java.sun.com/docs/books/tutorial/java/data/examples/ValueOfDemo.java] gets two strings from the command line, converts them to numbers, and performs arithmetic operations on the value. For supporting information see [The Java Tutorial: Object Basics and Simple Data Objects|http://java.sun.com/docs/books/tutorial/java/data/index.html].
----
Learn how to use numbers and math operations in applications written in the Java programming language.
* [BasicMathDemo.java|http://java.sun.com/docs/books/tutorial/java/data/examples/BasicMathDemo.java] illustrates how to get the absolute value, ceiling value, floor value, and relative integer value. For supporting information see [The Java Tutorial: Object Basics and Simple Data Objects|http://java.sun.com/docs/books/tutorial/java/data/index.html].
* [DecimalFormatDemo.java|http://java.sun.com/docs/books/tutorial/java/data/examples/DecimalFormatDemo.java] formats decimal numbers into strings. For supporting information see [The Java Tutorial: Object Basics and Simple Data Objects|http://java.sun.com/docs/books/tutorial/java/data/index.html].
* [ExponentialDemo.java|http://java.sun.com/docs/books/tutorial/java/data/examples/ExponentialDemo.java] displays the exponent value and calls the exp, log, pow, and sqrt methods on it. For supporting information see [The Java Tutorial: Object Basics and Simple Data Objects|http://java.sun.com/docs/books/tutorial/java/data/index.html].
* [MinDemo.java|http://java.sun.com/docs/books/tutorial/java/data/examples/MinDemo.java] finds the smaller of two values. For supporting information see [The Java Tutorial: Object Basics and Simple Data Objects|http://java.sun.com/docs/books/tutorial/java/data/index.html].
* [NumberDemo.java|http://java.sun.com/docs/books/tutorial/java/data/examples/NumberDemo.java] creates two Float objects and one Double object. For supporting information see [The Java Tutorial: Object Basics and Simple Data Objects|http://java.sun.com/docs/books/tutorial/java/data/index.html].
* [Numbers.java|http://java.sun.com/new2java/supplements/2001/Numbers.java] shows you how to perform various math operations on numbers received from the command line. For supporting information see [New to Java Programming Supplement, October 2001|http://java.sun.com/new2java/supplements/2001/oct01.html].
* RandomBagDemo.java generates random numbers. For supporting information see [The Java Tutorial: Object Basics and Simple Data Objects|http://java.sun.com/docs/books/tutorial/java/data/index.html].
* [ScoresAverage.java|http://java.sun.com/new2java/supplements/2001/ScoresAverage.java] shows you how to store numbers in an array and compute the average. For supporting information see [New to Java Programming Supplement, August 2001|http://java.sun.com/new2java/supplements/2001/july.html].
* [ToStringDemo.java|http://java.sun.com/docs/books/tutorial/java/data/examples/ToStringDemo.java] uses the toString method to convert a number to a string, and uses some string methods to compute the number of digits before and after the decimal point. For supporting information see [The Java Tutorial: Object Basics and Simple Data Objects|http://java.sun.com/docs/books/tutorial/java/data/index.html].
* [TrigonometricDemo.java|http://java.sun.com/docs/books/tutorial/java/data/examples/TrigonometricDemo.java] computes various trigonometric values for a 45-degree angle. For supporting information see [The Java Tutorial: Object Basics and Simple Data Objects|http://java.sun.com/docs/books/tutorial/java/data/index.html].
* [ValueOfDemo.java|http://java.sun.com/docs/books/tutorial/java/data/examples/ValueOfDemo.java] gets two strings from the command line, converts them to numbers, and performs arithmetic operations on the value. For supporting information see [The Java Tutorial: Object Basics and Simple Data Objects|http://java.sun.com/docs/books/tutorial/java/data/index.html].
----