You can use

Integer integer = Integer.valueOf(i);

From the javadoc of the constructor:

Deprecated. It is rarely appropriate to use this constructor. The static factory valueOf(int) is generally a better choice, as it is likely to yield significantly better space and time performance. Constructs a newly allocated Integer object that represents the specified int value.

The main difference is that you won't always get a new instance with valueOf as small Integer instances are cached.


All of the primitive wrapper types (Boolean, Byte, Char, Short, Integer, Long, Float and Double) have adopted the same pattern. In general, replace:

    new <WrapperType>(<primitiveType>)

with

    <WrapperType>.valueOf(<primitiveType>)

(Note that the caching behavior mentioned above differs with the type and the Java platform, but the Java 9+ deprecation applies notwithstanding these differences.)

Answer from Denys Séguret on Stack Overflow
Discussions

Integer has been deprecated and marked for removal
JRJdk13Compiler shows theses warnings:warning: [removal] Integer(int) in Integer has been deprecated and marked for removal value = new java.lang.Integer(1); //$JR_EXPR_ID=1$Most probably this deprecated syntax (new java.lang.Integer(int)) is used for initialization of Integer variables defined i... More on community.jaspersoft.com
🌐 community.jaspersoft.com
5
May 16, 2023
JDK 9 deprecates Number constructors, e.g. Integer(int)
I believe this isn't new, and has been going on for the last few versions at least. Industry-wide APIs are using more static code over the more Object-oriented ( Or "Instance" oriented? ) approach of the last decades. Constructors in general are used less, and static factory functions are used more. I've been doing this myself, using an "Immutable by default" approach to objects; "final" classes with all final members and with private constructors only but static factory methods. It seems that is tied to moving to a more Functional approach to languages and APIs. As higher concurrency requirements are causing this approach to look more attractive every day. More on reddit.com
🌐 r/java
72
144
September 16, 2016
Reports - Jasperreport - Integer has been deprecated and marked for removal value
While running the jasper report these warnings are shown: warning: [removal] Integer(int) in Integer has been deprecated and marked for removal value = new java.lang.Integer(1); //$JR_EXPR_ID=1$ Most probably this deprecated syntax (new java.lang.Integer(int)) is used for initialization of ... More on forum.jmix.io
🌐 forum.jmix.io
0
0
May 14, 2023
Java Lesson 21 Integer Deprecated
After playing the Java Lesson 21 Practice Solution Walkthrough, when I pressed run, it printed: Question.java:18: error: Integer(int) in java.lang.Integer has been deprecated and marked for removal output.put(parts[i], new Integer(1)); ^ 1 error Here’s a screenshot: More on forum.learncs.online
🌐 forum.learncs.online
0
0
December 27, 2023
🌐
Jsparrow
jsparrow.github.io › rules › inefficient-constructor.html
Replace Inefficient Constructors with valueOf() | jSparrow Documentation
For example new Integer("1") becomes Integer.valueOf("1"). Using this rule saves memory and CPU cycles, as the constructors are not needed in this case. Furthermore, the constructors are deprecated in Java 9, which is an indication that they will eventually be removed from the language altogether.
🌐
Coderanch
coderanch.com › t › 773726 › java › replace-statement-deprecated-constructor
Should I replace a statement with a deprecated constructor? (Java in General forum at Coderanch)
June 28, 2023 - "The constructor Integer(int) has been deprecated since version 9 and marked for removal"·. While it still works, is it going to work in the future?
🌐
Oracle
docs.oracle.com › javase › › 9 › docs › api › java › lang › Integer.html
Integer (Java SE 9 & JDK 9 )
Deprecated. It is rarely appropriate to use this constructor. Use parseInt(String) to convert a string to a int primitive, or use valueOf(String) to convert a string to an Integer object. Constructs a newly allocated Integer object that represents the int value indicated by the String parameter.
🌐
Jaspersoft Community
community.jaspersoft.com › home › forum › integer has been deprecated and marked for removal
Integer has been deprecated and marked for removal - Products - Jaspersoft Community
May 16, 2023 - JRJdk13Compiler shows theses warnings:warning: [removal] Integer(int) in Integer has been deprecated and marked for removal value = new java.lang.Integer(1); //$JR_EXPR_ID=1$Most probably this deprecated syntax (new java.lang.Integer(int)) is used for initialization of Integer variables defined i...
🌐
TutsWiki
tutswiki.com › java › wrapper-class
Wrapper Class in Java :: TutsWiki Beta
void wrapperClassExample1(){ Integer int1 = new Integer(1); // Deprecated since, Java 9 System.out.println(int1); Integer int2 = Integer.valueOf(2); System.out.println(int2); // Calculating Sum System.out.println(int1 + int2); // Example with another type Character another = Character.valueOf('a'); ...
🌐
Reddit
reddit.com › r/java › jdk 9 deprecates number constructors, e.g. integer(int)
r/java on Reddit: JDK 9 deprecates Number constructors, e.g. Integer(int)
September 16, 2016 - Java 9 is expanding the @Deprecated ... more aggressive in this area. ... There're both of two constructors, viz: Integer(int value) and Integer(String s) deprecated starting from JDK 9....
Find elsewhere
🌐
Eclipse
bugs.eclipse.org › bugs › show_bug.cgi
489986 – Replace new Integer() with Integer.valueOf() in org.eclipse.test
Bugzilla – Bug 489986 Replace new Integer() with Integer.valueOf() in org.eclipse.test Last modified: 2017-01-18 11:08:40 EST
🌐
Jmix
forum.jmix.io › support
Reports - Jasperreport - Integer has been deprecated and marked for removal value - Support - Jmix
May 14, 2023 - While running the jasper report these warnings are shown: warning: [removal] Integer(int) in Integer has been deprecated and marked for removal value = new java.lang.Integer(1); //$JR_EXPR_ID=1$ Most probably this deprecated syntax (new ...
🌐
OpenJDK
bugs.openjdk.org › browse › JDK-8354338
No longer deprecate wrapper class constructors for removal
April 10, 2025 - diff --git a/src/java.base/share/classes/java/lang/Integer.java b/src/java.base/share/classes/java/lang/Integer.java index a6bf739220f..78e124c2ea5 100644 --- a/src/java.base/share/classes/java/lang/Integer.java +++ b/src/java.base/share/classes/java/lang/Integer.java @@ -1024,7 +1024,7 @@ public static Integer valueOf(int i) { * {@link #valueOf(int)} is generally a better choice, as it is * likely to yield significantly better space and time performance. */ - @Deprecated(since="9", forRemoval = true) + @Deprecated(since="9") public Integer(int value) { this.value = value; } @@ -1046,7 +1046,7 @@ public Integer(int value) { * {@code int} primitive, or use {@link #valueOf(String)} * to convert a string to an {@code Integer} object.
🌐
Learncs
forum.learncs.online › bug reports
Java Lesson 21 Integer Deprecated - Bug Reports - learncs.online
December 27, 2023 - After playing the Java Lesson 21 Practice Solution Walkthrough, when I pressed run, it printed: Question.java:18: error: Integer(int) in java.lang.Integer has been deprecated and marked for removal output.put(parts[i], new Integer(1)); ^ 1 error ...
🌐
GitHub
github.com › protocolbuffers › protobuf › issues › 8462
Descriptors.java:1763: warning: [removal] Integer(int) in Integer has been deprecated and marked for removal · Issue #8462 · protocolbuffers/protobuf
April 7, 2021 - $ bazel build --config=java16 ... [removal] Integer(int) in Integer has been deprecated and marked for removal Integer key = new Integer(number); ^ Target //java/com/google/gerrit/common:server up-to-date: bazel-bin/java/co...
Author   protocolbuffers
🌐
Oracle
docs.oracle.com › javase › 10 › docs › api › java › lang › Integer.html
Integer (Java SE 10 & JDK 10 )
Deprecated. It is rarely appropriate to use this constructor. The static factory valueOf(int) is generally a better choice, as it is likely to yield significantly better space and time performance. Constructs a newly allocated Integer object that represents the specified int value.
🌐
Microsoft Learn
learn.microsoft.com › en-us › dotnet › api › java.lang.integer.-ctor
Integer Constructor (Java.Lang) | Microsoft Learn
[<Android.Runtime.Register(".ctor", "(I)V", "")>] new Java.Lang.Integer : int -> Java.Lang.Integer ... Constructs a newly allocated Integer object that represents the specified int value.
🌐
GeeksforGeeks
geeksforgeeks.org › java › difference-between-an-integer-and-int-in-java
Difference between an Integer and int in Java with Examples - GeeksforGeeks
July 11, 2025 - Java 9 to Java 15: The code will compile and run, but using new Integer(String) will generate a deprecation warning.
🌐
GeeksforGeeks
geeksforgeeks.org › java › the-deprecated-annotation-in-java
The @Deprecated Annotation in Java - GeeksforGeeks
August 17, 2022 - ... // Java Program Illustrating ... @Deprecated // Declaring and initializing integer variables int number = 100; // New field final int newnumber = 100; // Main public static void main(String a[]) { // Creating an object ...
🌐
GitHub
github.com › javapathfinder › jpf-core › issues › 47
Deprecated constructor calls with primitive argument - Xlint warnings · Issue #47 · javapathfinder/jpf-core
May 19, 2018 - [javac] /home/travis/build/javapathfinder/jpf-core/src/main/gov/nasa/jpf/vm/StackFrame.java:247: warning: [deprecation] Byte(byte) in Byte has been deprecated [javac] return new Byte((byte) v); [javac] ^ [javac] /home/travis/build/javapathfinder/jpf-core/src/main/gov/nasa/jpf/vm/StackFrame.java:249: warning: [deprecation] Character(char) in Character has been deprecated [javac] return new Character((char) v); [javac] ^ [javac] /home/travis/build/javapathfinder/jpf-core/src/main/gov/nasa/jpf/vm/StackFrame.java:251: warning: [deprecation] Short(short) in Short has been deprecated [javac] return new Short((short) v); [javac] ^ [javac] /home/travis/build/javapathfinder/jpf-core/src/main/gov/nasa/jpf/vm/StackFrame.java:253: warning: [deprecation] Integer(int) in Integer has been deprecated [javac] return new Integer(v); [javac] ^
Author   javapathfinder
🌐
Programmersought
programmersought.com › article › 21592721700
[Java] Warning: The constructor Integer (int) is deprecated since version 9 - Programmer Sought
Test code below: NoteJDK9The next version of execution Int Integer is a packaging, in general, both a converter with an operation of automatic packing or unpacking, it is to be noted that the Integer ... ... Docker starts ES error: OpenJDK 64-Bit Server VM warning: Option UseConcMarkSweepGC was deprecated in version 9 · ‘constructor FragmentStatePagerAdapter(FragmentManager)‘ is deprecated. Deprecated in Java