Java TimeUnit Calculate getValueString(long value, TimeUnit unit)

Here you can find the source of getValueString(long value, TimeUnit unit)

Description

get Value String

License

Apache License

Declaration

private static String getValueString(long value, TimeUnit unit) 

Method Source Code


//package com.java2s;
//License from project: Apache License 

import java.util.concurrent.TimeUnit;

public class Main {
    private static String getValueString(long value, TimeUnit unit) {
        String result = value + " " + unit.toString().toLowerCase();

        if (value == 1) {
            result = result.substring(0, result.length() - 1);
        }//w  ww  .j  av a2  s. c  om

        return result;
    }
}

Related

  1. getTimeInMillis(TimeUnit unit)
  2. getTimeString(long value, TimeUnit unit)
  3. getTimeUnit(Object units)
  4. getTimeUnit(String timeUnit, TimeUnit defaultUnit)
  5. getTimeUnitByName(String timeUnit, TimeUnit defaultTimeUnit)
  6. getWindowFlooredBinaryTime(TimeUnit unit, long timestamp, int windowSizeInSeconds)
  7. humanReadableTime(long time, TimeUnit unit)
  8. isValidTimeUnit(String timeUnit)
  9. logTiming(String description, int n, long time, TimeUnit unit)