private int hexToInt(String hex)
	{
		int total = 0;
		for (int i = 0; i < hex.length(); i++)
		{
			char c = hex.charAt(i);
			if (c >= '0' && c <= '9')
				total = total * 16 + c - '0';
			else
				total = total * 16 + c - 'a' + 10;
		}

		return total;
	}