Code samples based on discussions on CodeRanch.com / JavaRanch.com