Java function test