Javatpoint Logo
Javatpoint Logo

Java Convert long to int

Java Convert long to int

We can convert long to int in java using typecasting. To convert higher data type into lower, we need to perform typecasting.

Typecasting in java is performed through typecast operator (datatype).

Here, we are going to learn how to convert long primitive type into int and Long object into int.

Java long to int Example

Let's see the simple code to convert long to int in java.

Test it Now

Output:

500

Java Long to int Example

We can convert Long object to int by intValue() method of Long class. Let's see the simple code to convert Long to int in java.

Test it Now

Output:

10
Next TopicJava int to double




Please Share

facebook twitter google plus pinterest

Learn Latest Tutorials


Preparation


Trending Technologies


B.Tech / MCA