Some java utility code