Here you can find the source of getALLLocalHostIP()
public static String[] getALLLocalHostIP()
//package com.java2s; //License from project: Open Source License import java.net.InetAddress; import java.net.UnknownHostException; public class Main { public static String[] getALLLocalHostIP() { String[] ipSet = null;//from w w w. j ava 2 s. com String hostName = getLocalHostName(); if (hostName.length() > 0) { try { InetAddress[] addresses = InetAddress.getAllByName(hostName); ipSet = new String[addresses.length]; for (int i = 0; i < addresses.length; i++) { ipSet[i] = addresses[i].getHostAddress(); } } catch (UnknownHostException e) { ipSet = null; } } return ipSet; } public static String getLocalHostName() { String name = ""; try { InetAddress address = InetAddress.getLocalHost(); name = address.getHostName(); } catch (UnknownHostException e) { name = ""; } return name; } }