some java utility code