I am new to Java.
Coming from Python, I find it way more tedious to deal with arrays in Java than Python.
Specifically, to access arrays' positions.
This is the Python code I want to translate to Java:
# Access first 3 elements
arr = [1, 2, 3, 4, 5]
arr[:3]
output: [1, 2, 3]
But in Java, there is no "colon", and the shortest way I have found to get the first three elements is throuh a loop.
Is there a package or a non-loop way to do this?