In
Java, everything is passed by value. Primitives are copied and passed on to the method and references are copied also but they still reference the same object on the heap.
If you want to pass a primitive by reference, the only I know of is to wrap it in an array and pass the array to the method. For instance,