5

I know in Java that "int" is a 32 bit integer and that "long" is a 64 integer. I also know that in C "long long" is an integer at least as large as "long" (but implementation specific).

However I have recently come across some Java code using "long long" and wanted to know how exactly it was defined?

1
  • I know this is old, but I had the same question and it seems, also from a test. Here is the code: int equi(int arr[], int n) { if (n==0) return -1; long long sum = 0; int i; for(i=0;i<n;i++) sum+=(long long) arr[i]; long long sum_left = 0; for(i=0;i<n;i++) { long long sum_right = sum - sum_left - (long long) arr[i]; if (sum_left == sum_right) return i; sum_left += (long long) arr[i]; } return -1; }
    – Brian
    Aug 31, 2016 at 2:42

4 Answers 4

18

There is no such type in Java. Are you sure the code you read was written in Java? Maybe it was a JNI routine that was called into?

1
  • 5
    Apologies code was supplied as the answer to a Java programming test, but it appears to have been written in C. Feb 19, 2012 at 17:14
2

I do not know a type called "long long".

it isn't also listed here: http://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html

1

"long long" not supported in java

1
  • In java we just use long that support 64 bit width , like as in for c++(long long) Apr 4, 2017 at 11:04
0

It support
int-16bit
long-32bit
for big number calculation you can use long as well as int .

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.