This is the examples from Ian's Java Cookbook, and a bunch of other Java demonstration programs. In short: Java code, lots of it.
The latest source code is always available in in javasrc on GitHub.com. You can "git clone" if you want updates, or download a single archive if you don't. For some lighter fare, you can also view individual files on that web link.
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 any way including 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.
I do ask that you credit me as the original source of the material. The following should suffice:
The Original Author of this code is Ian Darwin, http://www.darwinsys.com/. Some code from the O'Reilly Java Cookbook, Fourth Edition, ISBN-13: 9781492072583
I would also appreciate, as a matter of courtesy, that you notify me if you use this code in any published papers (academic or otherwise). Thank you.
To those who doubt that the current version builds, I offer the following log of downloading and building the entire 'javasrc' sourcecode, from scratch, in a clean directory.
This code requires Java SE 11 (JDK 1.11) or later. If you want to use older versions of Java, some files will not compile; just remove them or add to the "exclude from compilation" list.
If you have other questions, please read the FAQ (Frequently Asked Questions) and the Errata Pages (at the O'Reilly site).