Here you can find the source of greaterThan(InetAddress inetAddress1, InetAddress inetAddress2)
public static boolean greaterThan(InetAddress inetAddress1, InetAddress inetAddress2)
//package com.java2s; /**//ww w .j a va 2 s .com * This file is a part of Angry IP Scanner source code, * see http://www.angryip.org/ for more information. * Licensed under GPLv2. */ import java.net.InetAddress; public class Main { /** * Compares two IP addresses. * @return true in case inetAddress1 is greater than inetAddress2 */ public static boolean greaterThan(InetAddress inetAddress1, InetAddress inetAddress2) { byte[] address1 = inetAddress1.getAddress(); byte[] address2 = inetAddress2.getAddress(); for (int i = 0; i < address1.length; i++) { if ((address1[i] & 0xFF) > (address2[i] & 0xFF)) return true; else if ((address1[i] & 0xFF) < (address2[i] & 0xFF)) break; } return false; } }