code: public static String toDuration(long time) {
          String duration = null;
          if (time >= 86400000) {
              duration = TimeUnit.MILLISECONDS.toMinutes(time) + " d";
          } else if (time >= 3600000) {
              duration = TimeUnit.MILLISECONDS.toMinutes(time) + " h";
          } else if (time >= 60000) {
              duration = TimeUnit.MILLISECONDS.toMinutes(time) + " min";
          } else if (time < 1000) {
              duration = time + " ms";
          } else {
              duration = TimeUnit.MILLISECONDS.toSeconds(time) + " s";
          }
          return duration;
      }
docs: <p>toDuration.</p>
  
  @param time a long.
  @return a {@link java.lang.String} object.