Answers for "java convert long to integer"

3

long to int java 8

import static java.lang.Math.toIntExact;

long foo = 10L;
int bar = toIntExact(foo);
Posted by: Guest on April-03-2020
4

java long to int

public class LongToIntExample2{
      
    	public static void main(String args[]){
          
        	Long l= new Long(10);
        	int i=l.intValue();
        	System.out.println(i);
    	
        }
    }
Posted by: Guest on November-21-2020
0

int to long java

Long l= new Long(i); //first way
Long l2=Long.valueOf(i); //second way
Posted by: Guest on June-22-2020
1

java long to int

long foo = 10L;
int bar = (int) foo;
Posted by: Guest on August-14-2021
0

java long to integer

// auto-unboxing does not go from Long to int directly, so
Integer i = (int) (long) theLong;
Posted by: Guest on November-25-2020

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language