How to change Long to Integer

Asked 1 years ago, Updated 1 years ago, 140 views

How can I change Long to Integer?

java long integer convert

2022-09-22 13:51

1 Answers

Integer i = theLong != null ? theLong.intValue() : null;

You can do it this way, or if you don't have to worry about null, you can do it as below.

Integer i = (int) (long) theLong;


2022-09-22 13:51

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.