Answers for "simple timeout code java"

3

java time code

final long startTime = System.currentTimeMillis();
for (int i = 0; i < length; i++) {
  // Do something
}
final long endTime = System.currentTimeMillis();

System.out.println("Total execution time: " + (endTime - startTime));
Posted by: Guest on April-21-2020
0

java socket timeout

Socket socket = new Socket();						// 1000 milliseconds
socket.connect(new InetSocketAddress(ipAddress, port), 1000);
Posted by: Guest on December-31-2020

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language