Sum from 1 to n in Java