Check if network is point to point in Java
Description
The following code shows how to check if network is point to point.
Example
import java.net.NetworkInterface;
import java.util.Enumeration;
//from ww w. j a v a 2 s . c o m
public class Main {
public static void main(String[] args) throws Exception {
Enumeration<NetworkInterface> en = NetworkInterface.getNetworkInterfaces();
while (en.hasMoreElements()) {
NetworkInterface ni = en.nextElement();
System.out.println(" Display Name = " + ni.getDisplayName());
System.out.println(" Is point to point = " + ni.isPointToPoint());
}
}
}
The code above generates the following result.