// Path: library/src/main/java/com/stealthcopter/networktools/ping/PingResult.java
// public class PingResult {
//     public final InetAddress ia;
//     public boolean isReachable;
//     public String error = null;
//     public float timeTaken;
//     public String fullString;
//     public String result;
// 
//     public PingResult(InetAddress ia) {
//         this.ia = ia;
//     }
// 
//     public boolean isReachable() {
//         return isReachable;
//     }
// 
//     public boolean hasError() {
//         return error != null;
//     }
// 
//     public float getTimeTaken() {
//         return timeTaken;
//     }
// 
//     public String getError() {
//         return error;
//     }
// 
//     public InetAddress getAddress() {
//         return ia;
//     }
// 
//     @Override
//     public String toString() {
//         return "PingResult{" +
//                 "ia=" + ia +
//                 ", isReachable=" + isReachable +
//                 ", error='" + error + '\'' +
//                 ", timeTaken=" + timeTaken +
//                 ", fullString='" + fullString + '\'' +
//                 ", result='" + result + '\'' +
//                 '}';
//     }
// }
// 
// Path: library/src/main/java/com/stealthcopter/networktools/subnet/Device.java
// public class Device {
//     public String ip;
//     public String hostname;
//     public String mac;
//     public float time = 0;
// 
//     public Device(InetAddress ip) {
//         this.ip = ip.getHostAddress();
//         this.hostname = ip.getCanonicalHostName();
//     }
// 
//     @Override
//     public String toString() {
//         return "Device{" +
//                 "ip='" + ip + '\'' +
//                 ", hostname='" + hostname + '\'' +
//                 ", mac='" + mac + '\'' +
//                 ", time=" + time +
//                 '}';
//     }
// }


import com.stealthcopter.networktools.ping.PingResult;
import com.stealthcopter.networktools.subnet.Device;
import java.net.InetAddress;
import java.net.UnknownHostException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.TimeUnit;
                    Runnable worker = new SubnetDeviceFinderRunnable(add);
                    executor.execute(worker);
                }

                // This will make the executor accept no new threads
                // and finish all existing threads in the queue
                executor.shutdown();
                // Wait until all threads are finish
                try {
                    executor.awaitTermination(1, TimeUnit.HOURS);
                } catch (InterruptedException e) {
                    e.printStackTrace();
                }

                // Loop over devices found and add in the MAC addresses if missing.
                // We do this after scanning for all devices as /proc/net/arp may add info
                // because of the scan.
                ipMacHashMap = disableProcNetMethod ? ARPInfo.getAllIPandMACAddressesFromIPSleigh() : ARPInfo.getAllIPAndMACAddressesInARPCache();
                for (Device device : devicesFound) {
                    if (device.mac == null && ipMacHashMap.containsKey(device.ip)) {
                        device.mac = ipMacHashMap.get(device.ip);
                    }
                }


                listener.onFinished(devicesFound);

            }
        }).start();

// Path: library/src/main/java/com/stealthcopter/networktools/ping/PingResult.java
// public class PingResult {
//     public final InetAddress ia;
//     public boolean isReachable;
//     public String error = null;
//     public float timeTaken;
//     public String fullString;
//     public String result;
// 
//     public PingResult(InetAddress ia) {
//         this.ia = ia;
//     }
// 
//     public boolean isReachable() {
//         return isReachable;
//     }
// 
//     public boolean hasError() {
//         return error != null;
//     }
// 
//     public float getTimeTaken() {
//         return timeTaken;
//     }
// 
//     public String getError() {
//         return error;
//     }
// 
//     public InetAddress getAddress() {
//         return ia;
//     }
// 
//     @Override
//     public String toString() {
//         return "PingResult{" +
//                 "ia=" + ia +
//                 ", isReachable=" + isReachable +
//                 ", error='" + error + '\'' +
//                 ", timeTaken=" + timeTaken +
//                 ", fullString='" + fullString + '\'' +
//                 ", result='" + result + '\'' +
//                 '}';
//     }
// }
// 
// Path: library/src/main/java/com/stealthcopter/networktools/subnet/Device.java
// public class Device {
//     public String ip;
//     public String hostname;
//     public String mac;
//     public float time = 0;
// 
//     public Device(InetAddress ip) {
//         this.ip = ip.getHostAddress();
//         this.hostname = ip.getCanonicalHostName();
//     }
// 
//     @Override
//     public String toString() {
//         return "Device{" +
//                 "ip='" + ip + '\'' +
//                 ", hostname='" + hostname + '\'' +
//                 ", mac='" + mac + '\'' +
//                 ", time=" + time +
//                 '}';
//     }
// }


// Path: library/src/main/java/com/stealthcopter/networktools/SubnetDevices.java
import com.stealthcopter.networktools.ping.PingResult;
import com.stealthcopter.networktools.subnet.Device;
import java.net.InetAddress;
import java.net.UnknownHostException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.TimeUnit;

                    Runnable worker = new SubnetDeviceFinderRunnable(add);
                    executor.execute(worker);
                }

                // This will make the executor accept no new threads
                // and finish all existing threads in the queue
                executor.shutdown();
                // Wait until all threads are finish
                try {
                    executor.awaitTermination(1, TimeUnit.HOURS);
                } catch (InterruptedException e) {
                    e.printStackTrace();
                }

                // Loop over devices found and add in the MAC addresses if missing.
                // We do this after scanning for all devices as /proc/net/arp may add info
                // because of the scan.
                ipMacHashMap = disableProcNetMethod ? ARPInfo.getAllIPandMACAddressesFromIPSleigh() : ARPInfo.getAllIPAndMACAddressesInARPCache();
                for (Device device : devicesFound) {
                    if (device.mac == null && ipMacHashMap.containsKey(device.ip)) {
                        device.mac = ipMacHashMap.get(device.ip);
                    }
                }


                listener.onFinished(devicesFound);

            }
        }).start();

        return this;