DELL
2025-04-28 e6eb7fb0af366e370f125668d62e89eb0004f517
Device_Simulator_DTS_Tester/src/com/Com.java
@@ -354,4 +354,56 @@
   public static void setTFDocLimit(JTextField tf, int charlen, String str) {
      tf.setDocument(new LimitedDocument(charlen, str));
   }
   /**
    * 将时间转化成H:M:S
    * @param min
    * @return
    */
   public static String minConvertHourMinSecond(Integer min) {
      String result = "";
      if (min != null) {
         Integer m = min;
         String format;
         Object[] array;
         Integer days = m / (60 * 24);
         Integer hours = m / (60) - days * 24;
         Integer minutes;
         Integer second;
         if (days > 0) {
            hours += days * 24;
            minutes = m - hours * 60;
            second = ( m - minutes - hours * 60) / 60;
         }else{
            minutes = m - hours * 60 - days * 24 * 60;
            second = (m - minutes - hours * 60) / 60;
         }
         String hoursstr = null;
         String minutesstr  = null;
         String secondstr = null;
         if(hours < 10){
            hoursstr = "0"+hours;
         }else {
            hoursstr = hours + "";
         }
         if(minutes < 10){
            minutesstr="0"+minutes;
         }else {
            minutesstr = minutes + "";
         }
         if(second < 10){
            secondstr="0"+second;
         }else {
            secondstr = second + "";
         }
         format = "%1$s:%2$s:%3$s";
         array = new Object[]{hoursstr, minutesstr,secondstr};
         result = String.format(format, array);
      }
      return result;
   }
   public static void main(String[] args) {
      System.out.println(minConvertHourMinSecond(61));
   }
}