-3

A simple question: Can someone help me declare a long long array in Java? I've tried to cast it, but no luck:

(long long)[] sum = new (long long)[10];

Also, I searched across the internet and didn't really find anyone who uses long long to define an array Any help please?

Fisher Coder
  • 2,388
  • 10
  • 32
  • 65
  • Don't use images to show code. – Kayaman May 16 '16 at 16:16
  • 2
    `long long` isn't a type in Java. – resueman May 16 '16 at 16:16
  • 2
    "I know for one variable, we can just declare it to be (long long) var;" are you sure about it? Which part of tutorial/specification makes you think it should be OK to use `long long` in Java? – Pshemo May 16 '16 at 16:16
  • 2
    Obvious [X Y Problem](http://meta.stackexchange.com/questions/66377/what-is-the-xy-problem). What are you *actually* trying to do here? – tnw May 16 '16 at 16:20
  • http://blog.codility.com/2011/03/solutions-for-task-equi.html @Pshemo – Fisher Coder May 16 '16 at 16:20
  • That page mentions multiple languages - the sample code is *not* Java. – Jon Skeet May 16 '16 at 17:37
  • Interesting. This post contained a spam link when I first viewed it. I flagged it, but it got declined because the link was edited out. You can still see it in the edit history. – Kayaman May 20 '16 at 06:52

3 Answers3

1

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

Are you sure the code you read was written in Java? Maybe it was a JNI routine that was called into?

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

1

There is no long long type in Java.

If you need an arbitrarily-long integer type, you can use BigInteger, but this is a reference type, and has no "convenient" operators like +.

Andy Turner
  • 122,430
  • 10
  • 138
  • 216
1

long long is not a valid type in java

using a big integer would make more sense in this case...

BigInteger[] sum = new BigInteger[10];
ΦXocę 웃 Пepeúpa ツ
  • 43,054
  • 16
  • 58
  • 83