Diverse java problems solved for fun