Java Maths Class
In Java, there exists a Math Library that can simplify intricate calculations
Library:
import java.lang.Math;
Use:
Math.function_name <parameters>
Functions |
Returns or Calculates |
---|---|
min( int a,int b ) |
minimum of a and b |
max( int a,int b ) |
maximum of a and b |
sin( int θ ) |
sine of θ |
cos( int θ ) |
cosine of θ |
tan( int θ) |
tangent of θ |
toRadians( int θ ) |
Convert angle in degrees(θ) to radians |
toDegrees( int θ ) |
Convert angle int radians(θ) to degrees |
exp( int a ) |
exponential value ea |
log( int a ) |
natural log -> logea |
pow( int a, int b ) |
power ab |
round( double a ) |
round to the nearest integer |
random() |
returns the random value in [0,1) |
sqrt( int a ) |
the square root of a |
E |
value of e (constant value) |
PI |
Value of π(constant value) |
Note: All the functions mentioned above can be used with either data-types not bounded any single data-types.
Java Cheat Sheet
Java is a programming language and platform that has been widely used since its development by James Gosling in 1982. It follows the Object-oriented Programming concept and can run programs written in any programming language. Java is a high-level, object-oriented, secure, robust, platform-independent, multithreaded, and portable programming language All those words are collectively called Java Buzzwords. It is commonly used for programming web-based, window, enterprise, and mobile applications. This Java Cheat Sheet article has been written by experts in Java and based on the experience of students who have recently undergone Java interviews.
This Core Java Cheat Sheet has been designed by Java experts, based on the experience of students who have recently undergone Java interviews. Whether you are a beginner or an experienced Java developer, this Java Cheat Sheet is a valuable resource for quickly accessing essential syntax, concepts, and best practices related to Java Programming.