Adding some Java from UW CSE that's generic enough