NumericIP extends StroomExtensionFunctionCall { String convert(final String ipAddress) { final String[] parts = ipAddress.split("\\."); int exp = parts.length - 1; long num = 0; for (final String part : parts) { num += Long.parseLong(part) * Math.pow(256, exp--); } return String.valueOf(num); }    }
@Test void test() { final NumericIP numericIP = new NumericIP(); String out = numericIP.convert("192.168.1.1"); System.out.println(out); assertThat(out).isEqualTo("3232235777"); out = numericIP.convert("192.168.1.2"); System.out.println(out); assertThat(out).isEqualTo("3232235778"); out = numericIP.convert("255.255.255.255"); System.out.println(out); assertThat(out).isEqualTo("4294967295"); out = numericIP.convert("0.0.0.0"); System.out.println(out); assertThat(out).isEqualTo("0"); out = numericIP.convert("1.1.1.1"); System.out.println(out); assertThat(out).isEqualTo("16843009"); }