basic java function. if else statement, loops, and array