Java working better