r/javahelp • u/uf82 • Dec 03 '14
Gangnam Style and 32bit Integer
Yes, YouTube video view count is limited to a 32 bit Integer. Gangnam Style has more so YouTube will fix it. Channel views do not have this problem.
I have a question. Is there 64bit integers available to programmers using 64bit architecture? If not, why not?
Thanks.
1
u/uf82 Dec 03 '14
Thank you for your answers. I also went looking for some documentation.
http://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html
2
u/brunokim Dec 03 '14 edited Dec 03 '14
In Java, numbers have fixed size, regardless of architecture.
byteis 8-bit (duh)shortis 16-bitintis 32-bitlongis 64-bit
The architecture will influence the performance of your code. If you do CPU-intensive operations in longs, you should expect a 2x speedup for switching from a 32-bit to a 64-bit architecture.
1
u/RhoOfFeh Dec 03 '14
Of course. The long primitive type is a 64 bit signed integer (unsigned available with new JDKs)
1
u/tec5c Dec 03 '14
Yes.
In Java the primitive long is a 64 bit integer.
In a 32 bit processor a 64 bit integer is stored as two 32 bit words.
4
u/IXENAI Dec 03 '14
Of course; you can use 64-bit integers on a 32-bit architecture as well. Java defines an
intas a 32-bit signed two's complement integer, and alongas a 64-bit signed two's complement integer regardless of the host platform's underlying architecture.