Changed the java function