I'd like to ask something confuses me a lot. Here is the scenario, lets say I have a method `preparePayload` that takes some argument like `messageType`, `destAddr` etc. The duty of method is construct a fully payload (with headers, prefixes etc). Here is the problem, I want to return `statusCode` (which is enum, like `STATUS_OK`,`STATUS_INVALID_DEST`, `STATUS_INVALID_MSG_TYPE` etc.), and than respect to return status I'd like to implement my logic. But if there is no error (`STATUS_OK`), I need the prepared payload to move on. So my method should return eighter payload or status code. 

In C language, simply sending payload buffer address as an argument to preparePayload method solves the problem perfectly. When the method returns, simply reading payload from the buffer address and moving on the application works. How can I implement this kind of logic in Java? 

In addition, `preparePayload` method is just an example I gave, so the methods I implemented may return `String`, `int[]`, some class object that I wrote etc. I mean, the type of object that method should return in success case may vary. 

Any suggestion will very welcome.