public static String readableTimespan(long milliseconds) {
    if (milliseconds == 0) {
      return "0 sec";
    }

    long seconds = milliseconds / 1000;
    long minutes = seconds / 60;
    long hours = minutes / 60;
    minutes %= 60;
    seconds %= 60;
    StringBuilder sb = new StringBuilder();
    if (hours > 0) {
      sb.append(hours).append(" hr ");
    }
    if (minutes > 0) {
      sb.append(minutes).append(" min ");
    }
    if (seconds > 0) {
      sb.append(seconds).append(" sec ");
    }
    return sb.toString().trim();
  }
Convert milliseconds to readable value

@param milliseconds The number of milliseconds
@return A String of readable time
app/com/linkedin/drelephant/math/Statistics.java