enhance java function