Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is long always 64 bit in both 32 and 64 bit machine

Tags:

java

I am wondering if long is 64 bits in both x86 and x64?

like image 390
user705414 Avatar asked Jan 06 '12 15:01

user705414


People also ask

Is long 64-bit or 32-bit?

int , long , ptr , and off_t are all 32 bits (4 bytes) in size. int is 32 bits in size. long , ptr , and off_t are all 64 bits (8 bytes) in size.

Is Long Long always 64-bit?

LL refers to the long long integer type, which is at least 64 bits on all platforms, including 32-bit environments. There are also systems with 64-bit processors using an ILP32 data model, with the addition of 64-bit long long integers; this is also used on many platforms with 32-bit processors.

Is long in Java 64-bit?

long: The long data type is a 64-bit two's complement integer. The signed long has a minimum value of -263 and a maximum value of 263-1. In Java SE 8 and later, you can use the long data type to represent an unsigned 64-bit long, which has a minimum value of 0 and a maximum value of 264-1.


1 Answers

Yes. A Java long is 64 bits on any JVM, without exception. All the Java primitive types are completely portable and have fixed sizes across all implementations.

like image 176
Ernest Friedman-Hill Avatar answered Nov 13 '22 23:11

Ernest Friedman-Hill