src/org/kocakosm/pitaya/time/Duration.java
public static Duration parse(String duration)
	{
		String[] tokens = duration.toLowerCase().replace("and", "")
			.replaceAll("[,&\\+]", " ").replaceAll("-\\s+", "-")
			.replace("--", "").replaceAll("[\n\t\r]", " ").trim()
			.replaceAll("\\s+", " ").split("\\s");
		Parameters.checkCondition(tokens.length % 2 == 0);
		long ms = 0L;
		for (int i = 0; i < tokens.length; i += 2) {
			long v = Long.parseLong(tokens[i]);
			TimeUnit u = parseTimeUnit(tokens[i + 1]);
			ms = safeAdd(ms, MILLISECONDS.convert(v, u));
		}
		return new Duration(ms);
	}
public static Duration parse(String duration)
	{
		String[] tokens = duration.toLowerCase().replace("and", "")
			.replaceAll("[,&\\+]", " ").replaceAll("-\\s+", "-")
			.replace("--", "").replaceAll("[\n\t\r]", " ").trim()
			.replaceAll("\\s+", " ").split("\\s");
		Parameters.checkCondition(tokens.length % 2 == 0);
		long ms = 0L;
		for (int i = 0; i < tokens.length; i += 2) {
			long v = Long.parseLong(tokens[i]);
			TimeUnit u = parseTimeUnit(tokens[i + 1]);
			ms = safeAdd(ms, MILLISECONDS.convert(v, u));
		}
		return new Duration(ms);
	}
Parses the given duration's {@code String} representation into a
{@code Duration} instance. The given {@code String} must be a list
of value/unit pairs separated by ' ', '+', '-', '\n', '\t', '\r',
{@code '&'} or ',' characters or by the "and" {@code String}. Values
must be integer (either positive or negative) values. Valid units are:
"milliseconds", "millisecond", "millis" and "ms" for milliseconds,
"seconds", "second", "sec", "secs" and "s" for seconds, "minutes",
"minute", "min", "mins" and "m" for minutes, "hours", "hour" and "h"
for hours, "days", "day" and "d" for days. Values must be separated
from their unit by a whitespace character. Parsing is not case
sensitive.

@param duration the {@code String} to parse into a {@code Duration}.

@return the parsed {@code Duration}.

@throws NullPointerException if {@code duration} is {@code null}.
@throws IllegalArgumentException if {@code duration} can't be parsed.
@throws ArithmeticException if the total duration value overflows the
storage capacity of this class.