Q:

The reason why I have to create int array instead of pass one directly as argument?

The closest one I can find is this thread:
How to pass int array as an argument to a constructor?
The answer is clear, you define an int[] tempArray and use that tempArray as argument. However, my question is why cannot I write the int array directly as argument.
The code example is like:
public static void main (String[] args) {
    NewClass test = new NewClass();
    // int[] tempArray = {1, 2, 3};
    // test.doSomething(tempArray);
    test.doSomething({1, 2, 3});
}

A:

You can. But the syntax for doing so requires new int[], because you can't use the syntactic sugar available with a declaration. Something like,
test.doSomething(new int[] {1, 2, 3});

A:

If you want to do so, you can use variable arguments. Make your test.doSomething() method like this:
void doSomething(int... arguments)
{
    // ...
}

Then you can pass the integers without requiring the new syntax. The compiler will take care of them.
test.doSomething(1, 2, 3);
test.doSomething(new int[] { 1, 2, 3 });

Both works now. Inside the method, the compiler automatically makes arguments as an array, so no change in the logic too.

