Because of java, primitives by value always pass and do not have built-in support for perl style lists. I am afraid that you cannot do what you need.
You can write the list method and pass the value and unit variables there. You can change the values ββof these variables. But the changes will only be visible in the list method. The initial values ββof value and unit will be the same as before the call.
The solution to this problem in the Java style is to create a custom class (even the inner class does not make sense in other contexts). Then create a method that parses your string (using a regular expression) and instantiates the class.
Alexr source share