public static boolean containIP(int cidrPrefix,int cidrMaskBits,int ip){
  boolean matched=true;
  int bitsToShift=32 - cidrMaskBits;
  if (bitsToShift > 0) {
    cidrPrefix=cidrPrefix >> bitsToShift;
    ip=ip >> bitsToShift;
    cidrPrefix=cidrPrefix << bitsToShift;
    ip=ip << bitsToShift;
  }
  if (cidrPrefix != ip) {
    matched=false;
  }
  return matched;
}

public static boolean containIP ( int cidrPrefix , int cidrMaskBits , int ip ) { boolean matched = true ; int bitsToShift = 32 - cidrMaskBits ; if ( bitsToShift > 0 ) { cidrPrefix = cidrPrefix > > bitsToShift ; ip = ip > > bitsToShift ; cidrPrefix = cidrPrefix << bitsToShift ; ip = ip << bitsToShift ; } if ( cidrPrefix != ip ) { matched = false ; } return matched ; }
check whether the cidr address contains the ip address
