Algorithm up to date with Java syntax