check in java sample code