various Java utility functions