public static String reverseWords(String s) {
		List<String> words = new ArrayList<String>();
		int len = s.length();
		StringBuffer res = new StringBuffer();
		String word = null;
		int begin = 0, end = 0;
		for (int i = 0; i < len; i++) {
			if (' ' == s.charAt(i)) {
				if (end != begin) {
					word = s.substring(begin, end);
					words.add(word);
					end = end + 1;
					begin = end;
				} else {
					end = i + 1;
					begin = end;
				}
			} else {
				end = i + 1;
			}
		}
		if (begin != end) {
			words.add(s.substring(begin, end));
		}
		for (int i = words.size() - 1; i >= 0; i--) {
			res.append(words.get(i));
			if (i != 0) res.append(" ");
		}
		return res.toString();
	}