Need suggestion in optimizing the below code : <p>I need some guidance as how can I optimize the below code. As one can see , i am creating a new object everytime to set each value. How can I do it in a better way</p>

<pre><code>Balance[] balance = new Balance[3];
CurAmt curAmt = new CurAmt();
Balance bal = new Balance();
bal.setBalType("currentBalance");
curAmt.setCurCode(entry.getValue().get(0).getAs("CURRENT_BALANCE_CURRENCY_CODE"));
curAmt.setContent(entry.getValue().get(0).getAs("CURRENT_BALANCE"));
bal.setCurAmt(curAmt);
balance[0] = bal;

CurAmt curAmt1 = new CurAmt();
Balance bal1 = new Balance();
bal1.setBalType("availableBalance");
curAmt1.setCurCode(entry.getValue().get(0).getAs("AVAILABLE_BALANCE_CURRENCY_CODE"));
curAmt1.setContent(entry.getValue().get(0).getAs("AVAILABLE_BALANCE"));
bal1.setCurAmt(curAmt1);
balance[1] = bal1;

CurAmt curAmt2 = new CurAmt();
Balance bal2 = new Balance();
bal2.setBalType("interestEarnedYtd");
curAmt2.setCurCode(entry.getValue().get(0).getAs("YTD_CURRENCY_CODE"));
curAmt2.setContent(entry.getValue().get(0).getAs("TD_AMOUNT"));
bal2.setCurAmt(curAmt2);
balance[2] = bal2;

Obj.setBalance(balance);
</code></pre>
