Here you can find the source of getUnitLengthMillis(String unit)
public static long getUnitLengthMillis(String unit)
//package com.java2s; public class Main { /**//from w ww. j av a2s. c o m * Gets the length of the given unit in milliseconds. This accepts * seconds, minutes, hours and days, and should be constant across calendar * systems. */ public static long getUnitLengthMillis(String unit) { unit = unit.trim(); if (unit.equals("seconds") || unit.equals("second") || unit.equals("secs") || unit.equals("sec") || unit.equals("s")) { return 1000; } else if (unit.equals("minutes") || unit.equals("minute") || unit.equals("mins") || unit.equals("min")) { return 1000 * 60; } else if (unit.equals("hours") || unit.equals("hour") || unit.equals("hrs") || unit.equals("hr") || unit.equals("h")) { return 1000 * 60 * 60; } else if (unit.equals("days") || unit.equals("day") || unit.equals("d")) { return 1000 * 60 * 60 * 24; } else { throw new IllegalArgumentException("Unrecognized unit for time axis: " + unit); } } }