Java code for SCSD project