import java.io.*;
import java.net.*;
import java.util.*;
import static java.lang.System.out;

public class ListNets
{


public static void main(String args[]) throws SocketException {
Enumeration<NetworkInterface> nets = NetworkInterface.getNetworkInterfaces();

for (NetworkInterface netint : Collections.list(nets))
displayInterfaceInformation(netint);
}

static void displayInterfaceInformation(NetworkInterface netint) throws SocketException {

Enumeration<InetAddress> inetAddresses = netint.getInetAddresses();

while(inetAddresses.hasMoreElements()==true)
{
System.out.println(inetAddresses.nextElement());


}




}
}

-------------------------------------------------------------------------
The output of this code gives only the ip of the computer im working on the network :192.168.1.101 and the local ip 127.0.0.1
although there are other computers connected to the netwrok .. i need to get all the ips connected including the ip of the router so if any 1 can please help me