addded basic rect java implementation