utility function in java