Array sum in Java