Changed the java function

Hi dave, check out my awesome changes!