Shared macros – the ImageJ macro directory
Last but not the least: while learning a new programming technique, it is important to practise it by your own, but it is also very helpful to read code written by others so that you can see how most common operations are done and can understand new ways of doing things. There are dozens of macros contributed by the ImageJ users available at http://rsbweb.nih.gov/ij/macros/. We encourage you to take a look at the text files in that directory as it is an incredibly rich resource.