Here you can find the source of toString(TimeUnit unit)
public static String toString(TimeUnit unit)
//package com.java2s; //License from project: Apache License import java.util.concurrent.TimeUnit; public class Main { private static final String[] names = new String[] { "ns", "us", "ms", "s", "min", "h", "d" }; public static String toString(TimeUnit unit) { return names[unit.ordinal()]; }//from www .j a v a 2 s. c om }