1) Take a look at the API for the intern method of the String Class
2) Take a look at the API for the ImageIO class, pay special attention to the methods with the name 'cache' in them