Code example for Date

Methods: toString

0
      return 0; 
    } 
  } 
   
  public static String getTimeStringFromMicrosecond(long microsecond) {
    Date timestamp = new Date(microsecond / 1000);
    return timestamp.toString();
  } 
 
  /** 
   * Returns a String array that contains the ICMP sequence number and the round 
   * trip time extracted from a ping output. The first array element is the 
   * sequence number and the second element is the round trip time. 
   *  
   * Returns a null object if either element cannot be found. 
   */ 
  public static String[] extractInfoFromPingOutput(String outputLine) {
    try { 
      Pattern pattern = Pattern.compile("icmp_seq=([0-9]+)\\s.* time=([0-9]+(\\.[0-9]+)?)");
      Matcher matcher = pattern.matcher(outputLine);
      matcher.find();