Renamed and wrote java solution