public boolean isHappy(int n) {
		HashSet<Integer> hashSet = new HashSet<Integer>();
		int val = n;
		while (!hashSet.contains(val)) {
			hashSet.add(val);
			val = square(val);
			if (val == 1)
				return true;
			
		}
		return false;
	}