Java Math incrementExact(int x) method Last Updated : 01 May, 2018 Comments Improve Suggest changes Like Article Like Report The java.lang.Math.incrementExact() is a built-in math function in java which returns the argument incremented by one.It throws an exception if the result overflows an int.As incrementExact(int x) is static, so object creation is not required. Syntax : public static int incrementExact(int x) Parameter : x : the value to be incremented Return : This method returns the argument incremented by one. Exception : It throws ArithmeticException - if the result overflows an int Example : To show working of java.lang.Math.incrementExact() method. java // Java program to demonstrate working // of java.lang.Math.incrementExact() method import java.lang.Math; class Gfg1 { // driver code public static void main(String args[]) { int a = 0; for (int i = 0; i < 5; i++) { a = Math.incrementExact(a); System.out.println(a); } } } Output: 1 2 3 4 5 java // Java program to demonstrate working // of java.lang.Math.incrementExact() method import java.lang.Math; class Gfg2 { // driver code public static void main(String args[]) { int x = Integer.MAX_VALUE; System.out.println(Math.incrementExact(x)); } } Output: Runtime Error : Exception in thread "main" java.lang.ArithmeticException: integer overflow at java.lang.Math.incrementExact(Math.java:909) at Gfg2.main(File.java:13) Comment More infoAdvertise with us Next Article Java Math incrementExact() Method N Niraj_Pandey Follow Improve Article Tags : Java Java-lang package java-math Practice Tags : Java Similar Reads Java Math incrementExact() Method The incrementExact() is a built-in function in Java provided by the Math class, which returns the argument incremented by one. It throws an exception if the result overflows the specified datatype, either long or int, depending on which data type has been used on the method argument.This method is h 2 min read Java Math incrementExact() Method The incrementExact() is a built-in function in Java provided by the Math class, which returns the argument incremented by one. It throws an exception if the result overflows the specified datatype, either long or int, depending on which data type has been used on the method argument.This method is h 2 min read Java Math decrementExact() method The java.strictmath.lang.decrementExact() is a built-in function in java which returns the argument decremented by one, throwing an exception if the result overflows the specified datatype either long or int depending on which data type has been used on the method argument. Since this is decrement, 2 min read LongAdder decrement() method in Java with Examples LongAdder class in Java creates a new adder with an initial sum of zero. The Java.LongAdder.decrement() is an inbuilt method in java that reduces the value by 1. Syntax: public void decrement() Parameters: The function does not accepts any parameter. Return value: The method do not returns any value 2 min read LongAdder decrement() method in Java with Examples LongAdder class in Java creates a new adder with an initial sum of zero. The Java.LongAdder.decrement() is an inbuilt method in java that reduces the value by 1. Syntax: public void decrement() Parameters: The function does not accepts any parameter. Return value: The method do not returns any value 2 min read Integer intValue() Method in Java intValue() of Integer class that is present inside java.lang package is an inbuilt method in java that returns the value of this integer as an int which is inherited from Number Class. The package view is as follows: --> java.lang Package --> Integer Class --> intValue() Method Syntax: publ 3 min read Like