Java TimeUnit Convert toString(TimeUnit unit)

Here you can find the source of toString(TimeUnit unit)

Description

to String

License

Apache License

Declaration

public static String toString(TimeUnit unit) 

Method Source Code


//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
}

Related

  1. toNanos(long timeout, TimeUnit unit)
  2. toSeconds(long duration, TimeUnit timeUnit)
  3. toSeconds(long timeout, TimeUnit unit)
  4. toSeconds(long value, TimeUnit unit)
  5. toSIAbbreviation(final TimeUnit timeUnit)
  6. toString(TimeUnit unit)
  7. toTime(final String value, final TimeUnit inputUnit, final TimeUnit outUnit)
  8. toTimePrecision(final TimeUnit t)
  9. toTimeUnits(long time)