public static String timeIntervalToString(long millis) {
        StringBuffer sb = new StringBuffer();
        if (millis < 10 * Constants.SECOND) {
            sb.append(millis);
            sb.append("ms");
        } else {
            boolean force = false;
            String stop = null;
            for (int ix = 0; ix < units.length; ix++) {
                UD iu = units[ix];
                long n = millis / iu.millis;
                if (force || n >= iu.threshold) {
                    millis %= iu.millis;
                    sb.append(n);
                    sb.append(iu.str);
                    force = true;
                    if (stop == null) {
                        if (iu.stop != null) {
                            stop = iu.stop;
                        }
                    } else {
                        if (stop.equals(iu.str)) {
                            break;
                        }
                    }
                }
            }
        }
        return sb.toString();
    }