Improved loops java files