public static long timeInMsOrTimeIfNullUnit ( long time , TimeUnit timeUnit ) { return timeUnit != null ? timeUnit . toMillis ( time ) : time ; }
Convert time to milliseconds based on the given time unit . If time unit is null then input time is treated as milliseconds .