Here you can find the source of increment(InetAddress address)
public static InetAddress increment(InetAddress address)
//package com.java2s; /**/*from w w w . j av a 2s. 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; import java.net.UnknownHostException; public class Main { /** * Increments an IP address by 1. */ public static InetAddress increment(InetAddress address) { try { byte[] newAddress = address.getAddress(); for (int i = newAddress.length - 1; i >= 0; i--) { if (++newAddress[i] != 0x00) break; } return InetAddress.getByAddress(newAddress); } catch (UnknownHostException e) { // this exception is unexpected here assert false : e; return null; } } }