abs in java
Java
// Java program to demonstrate working
// of java.lang.Math.abs() method
import java.lang.Math;
class Gfg {
// driver code
public static void main(String args[])
{
float a = 123.0f;
float b = -34.2323f;
double c = -0.0;
double d = -999.3456;
int e = -123;
int f = -0;
long g = -12345678;
long h = 98765433;
// abs() method taking float type as input
System.out.println(Math.abs(a));
System.out.println(Math.abs(b));
// abs() method taking double type as input
System.out.println(Math.abs(1.0 / 0));
System.out.println(Math.abs(c));
System.out.println(Math.abs(d));
// abs() method taking int type as input
System.out.println(Math.abs(e));
System.out.println(Math.abs(f));
System.out.println(Math.abs(Integer.MIN_VALUE));
// abs() method taking long type as input
System.out.println(Math.abs(g));
System.out.println(Math.abs(h));
System.out.println(Math.abs(Long.MIN_VALUE));
}
}
abs(intx);public class Test {
public static void main(String args[]) {
Integer a = -8;
double d = -100;
float f = -90;
System.out.println(Math.abs(a));
System.out.println(Math.abs(d));
System.out.println(Math.abs(f));
}
}
Also in Java:
- Title
- check if a char is a space java
- Category
- Java
- Title
- math.pow java
- Category
- Java
- Title
- java map declaration
- Category
- Java
- Title
- java pass arraylist by value
- Category
- Java
- Title
- array methods in java
- Category
- Java
- Title
- countdown timer with seekbar
- Category
- Java
- Title
- java replaceall single character
- Category
- Java
- Title
- numberformatexception
- Category
- Java
- Title
- The specified child already has a parent. You must call removeView() on the child's parent first
- Category
- Java
- Title
- how to add jar in maven java application in netbeans
- Category
- Java
- Title
- input java
- Category
- Java
- Title
- string contains java
- Category
- Java
- Title
- how to print ascii value in java
- Category
- Java
- Title
- do statement java
- Category
- Java
- Title
- iterate through hashmap java
- Category
- Java
- Title
- remove unused imports intellij
- Category
- Java
- Title
- declare bufferedreader java
- Category
- Java
- Title
- print hashtable in java
- Category
- Java
- Title
- find a substring in a string java
- Category
- Java
- Title
- how timer class and display to jtextfield w3schools in java
- Category
- Java
- Title
- méthode retourne nom classe java
- Category
- Java
- Title
- random code
- Category
- Java
- Title
- java arraylist to array
- Category
- Java
- Title
- java function that returns the index of the largest value in an array
- Category
- Java
- Title
- how to iterate hashset in java 8
- Category
- Java
- Title
- spigot custom join message
- Category
- Java
- Title
- list java oracle
- Category
- Java
- Title
- java array copy
- Category
- Java
- Title
- java builder pattern example
- Category
- Java
- Title
- gson parse json
- Category
- Java
- Title
- log4j print stacktrace
- Category
- Java
- Title
- how to make int array java android
- Category
- Java
- Title
- how to pass a float between activities in android studio
- Category
- Java
- Title
- rgb to hex java
- Category
- Java
- Title
- Java how to copy file
- Category
- Java
- Title
- iterate through hashtable java
- Category
- Java
- Title
- graal.js pass javascript array to java function
- Category
- Java
- Title
- hashset contains java
- Category
- Java
- Title
- two pointer approach java
- Category
- Java
- Title
- find length of array java
- Category
- Java
- Title
- string replace last character java
- Category
- Java
- Title
- Scanner library showing element not found exception
- Category
- Java
- Title
- FileNotFoundException: properties/fortunes.txt (No such file or directory)
- Category
- Java
- Title
- loop through array java
- Category
- Java
- Title
- java function without return
- Category
- Java
- Title
- java list to set
- Category
- Java
- Title
- java time code
- Category
- Java
- Title
- reverse a string in java
- Category
- Java
- Title
- else statement java
- Category
- Java
- Title
- spigot cancel repeating task
- Category
- Java
- Title
- How to chage font progrmatically
- Category
- Java
- Title
- java hashmap set value
- Category
- Java
- Title
- inputstream to string java
- Category
- Java
- Title
- how to create an abstract method in java
- Category
- Java
- Title
- 2d array length in java
- Category
- Java
- Title
- how to pass parameters to xsl file
- Category
- Java
- Title
- random boolean java
- Category
- Java
- Title
- socket in java
- Category
- Java
- Title
- mutable string in java
- Category
- Java
- Title
- logger in java
- Category
- Java
- Title
- org.mapstruct maven dependency
- Category
- Java
- Title
- how to change the icon of a jframe
- Category
- Java
- Title
- how to interrupt a void java
- Category
- Java
- Title
- how to use lambda in java
- Category
- Java
- Title
- java split string on two or more spaces except for words in quotes
- Category
- Java
- Title
- java read public key from keystore
- Category
- Java
- Title
- java random number
- Category
- Java
- Title
- how to create a Scanner Object in java
- Category
- Java
- Title
- java get size of array
- Category
- Java
- Title
- difference between java and javax
- Category
- Java
- Title
- how to initialize array in java
- Category
- Java
- Title
- cannot fit requested classes in a single dex file
- Category
- Java
- Title
- how-to-use-volley-string-request-in-android
- Category
- Java
- Title
- java open file
- Category
- Java
- Title
- show menuitem when menu hovered javafx
- Category
- Java
- Title
- string to int java
- Category
- Java
- Title
- if statement java
- Category
- Java
- Title
- break for loop java
- Category
- Java
- Title
- import java.util.hashset
- Category
- Java
- Title
- java is power of 2
- Category
- Java
- Title
- create java windows application
- Category
- Java
- Title
- java 8 retrieve all list from object into single list and ignore duplicates
- Category
- Java
- Title
- applicationcontext.xml
- Category
- Java
- Title
- kotlin android intent pass data
- Category
- Java
- Title
- arraylist get last
- Category
- Java
- Title
- import
- Category
- Java
- Title
- how to make a fixed size array in java
- Category
- Java
- Title
- java random char a-z
- Category
- Java
- Title
- how to print array in java using for loop
- Category
- Java
- Title
- equls en java
- Category
- Java
- Title
- java convert char to int
- Category
- Java
- Title
- how to delete character in string java
- Category
- Java
- Title
- read integer input java
- Category
- Java
- Title
- scanner check if int
- Category
- Java
- Title
- how to delete an element from an array in java
- Category
- Java
- Title
- parallel sorting in java 8
- Category
- Java
- Title
- java how to read file extension
- Category
- Java
- Title
- java how to stop code
- Category
- Java
- Title
- fragment manager in android
- Category
- Java
- Title
- ARE THERE POINTER IN JAVA
- Category
- Java