CORE API / NOTES</>↗Core API12 Mar 2010
To calculate the cube root and the square root of a double value we can use the Math.cbrt(double a) and Math.sqrt(double a) static method call. package org.kodejava.math; public class CubeSquareRootExample { public static void main(String[] args) { double cube = 125.0d; double square = 100.0d; // Get the cube root of double value double cubeRoot […]
CORE API / NOTES</>↗Core API09 Mar 2010
The example shown below tells you how to reread the contents of a buffer. To reread the data from a buffer we can use the buffer’s rewind() method. This method set the position back to 0 while the limit is unchanged, it still holds the value of how many data can be read from the […]
CORE API / NOTES</>↗Core API09 Mar 2010
This example demonstrates how to use the trigonometric methods of the java.lang.Math class. You can see the use of method such as Math.sin(), Math.cos(), Math.tan(), etc. package org.kodejava.math; public class TrigonometricExample { public static void main(String[] args) { double radians = 1.0d; double sine = Math.sin(radians); double cosine = Math.cos(radians); double tan = Math.tan(radians); double […]
CORE API / NOTES</>↗Core API06 Mar 2010
The example below show you how to convert an angle measured in radians into degrees and vice versa. We can use the Math.toDegrees() and Math.toRadians() method call to do the conversion. package org.kodejava.math; public class RadiansDegreeConversionExample { public static void main(String[] args) { double radians = 1.0d; double degrees = 45d; // Converts an angle […]
CORE API / NOTES</>↗Core API05 Mar 2010
The number π is a mathematical constant, the ratio of a circle’s circumference to its diameter, commonly approximated as 3.14159. It has been represented by the Greek letter “π” since the mid-18th century, though it is also sometimes spelled out as “pi” (/paɪ/). From: Wikipedia The code snippet below show you how to obtain the […]
CORE API / NOTES</>↗Core API02 Mar 2010
The code below show you how to use the Math.min() and Math.max() method call the get the minimum and maximum value between two numbers. As other method in the Math class these methods also overloaded to accept many types of primitive data. package org.kodejava.math; public class GetMinMaxValueExample { public static void main(String[] args) { Double […]