Convert scala to java