C.O.T.S. in java