Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public long toLong() {
- long t = (long) first << 24 | (long) second << 16 | (long) third << 8 | (long) fourth;
- if (mask == 32) return t;
- else return t - (t % toHostMask());
- }
- public long toHostMask() {
- return (long) 1 << (32 - mask);
- }
- public boolean in(IPAddress address) {
- long thisLong = this.toLong();
- long addressLong = address.toLong();
- return thisLong >= addressLong && thisLong <= (addressLong + address.toHostMask() - 1);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement