Here you can find the source of Negation(String StartIP, String netmask)
private static String Negation(String StartIP, String netmask)
//package com.java2s; public class Main { private static String Negation(String StartIP, String netmask) { String[] temp1 = StartIP.trim().split("\\."); String[] temp2 = netmask.trim().split("\\."); int[] rets = new int[4]; for (int i = 0; i < 4; i++) { rets[i] = Integer.parseInt(temp1[i]) & Integer.parseInt(temp2[i]); }/*from w w w . j a v a 2s .c o m*/ return rets[0] + "." + rets[1] + "." + rets[2] + "." + rets[3]; } }