codes for java CS 504