• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Max array size in Kotlin

I am programming in Kolin via Android Studio 3.1.3. I created an array of type Long that was apparently too large to compile. After playing around with it for a while, I found that the maximum size array I could get to compile contained 8,207 elements. An array with 8,208 or more caused a compilation error. There are 350 lines of elements in the array. Two questions:

1. Does anyone have any idea why this would be?

2. Is there any way to increase the allowed size of the array?

Code:
val primes: LongArray = longArrayOf(2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, 101, 103, 107, 109, 113, 127, 131, 137, 139, 149, 151, 157,
        163, 167, 173, 179, 181, 191,
...
84137, 84143, 84163, 84179, 84181, 84191)
 
Back
Top Bottom