Java : Best way to pass int by reference

后端 未结 7 2220
不知归路
不知归路 2020-11-28 05:36

I have a parsing function that parses an encoded length from a byte buffer, it returns the parsed length as an int, and takes an index into the buffer as an integer arg. I

7条回答
  •  借酒劲吻你
    2020-11-28 05:49

    This isn't possible in Java. As you've suggested one way is to pass an int[]. Another would be do have a little class e.g. IntHolder that wrapped an int.

提交回复
热议问题