This is the examples from Ian's Java Cookbook, and a bunch of other Java demonstration programs. In short: Java code, lots of it.
Pretty much anything, except claim that you wrote it.
O'Reilly's general policy is: "You can use and redistribute example code from our books for any non-commercial purpose (and most commercial purposes) as long as you acknowledge their source and authorship. The origin of the code should be noted in any documentation as well as in the program code itself (as a comment). The attribution should include author, title, publisher and ISBN..." All the code I wrote is under the BSD license which is even more liberal. You definitely may use this code in commercial projects, as many people have. You do not have to ask me every time. In fact, please do not ask me; I am busy enough that I am quite likely to ignore such queries. Read more on the O'Reilly Web Site.
If you have other questions, please read the FAQ (Frequently Asked Questions) and the Errata Pages (at the O'Reilly site).
You can download the latest (but it's not very recent, alas) complete tarball (well, zip file) from O'Reilly at http://examples.oreilly.com/javacook2/ (local copy here). Note that this tarball is only re-created periodically, while changes are made in my public CVS repository ... as soon as I get them working (occasionally, I must admit, before that).
For some lighter fare, you can also download files individually.
You can still access the last revision of the First Edition Java Cookbook files here. But you should not do this - the Second Edition download is much better! If you want the old ones, here's how... To get started, everybody is likely to need this download of the binary files for the com.darwinsys.jar package.
Here is the complete download of the program files from the book Warning - this is not being updated. I really recommend that everybody upgrades to the Second Edition of the book, not just because I like to sell books, but because it really is so much better!