public String fractionToDecimal(int numerator, int denominator) {

		if (numerator == 0)
			return "0";
		StringBuilder sb = new StringBuilder();
		String sign = new String();
		if (numerator < 0 ^ denominator < 0)	//不能同时小于零
			sign="-";

		long n = Math.abs((long)numerator);
		long d = Math.abs((long)denominator);
		HashMap<Long, Integer> map = new HashMap<Long, Integer>();
		
		long r = n % d;
		if (r == 0) {
			sb.append(sign);
			sb.append(n / d);
			return sb.toString();
		} 

		while (r != 0) {
			if (map.containsKey(r)) {
				sb.insert(map.get(r), "(");
				sb.append(")");
				break;
			}
			map.put(r, map.size());
			r*=10;
			sb.append(r/d);
			r=r%d;
		}
		sb.insert(0, sign);
		sb.insert(0, n/d+".");
		return sb.toString();

	}