as we did not find a good library to perform subnet calculations in Java. The library is available under BSD license. It is just one file: IPv4.java. Syntax-highlited HTML version here: IPv4-colorized.html. Enjoy.
IPCalculator is ported to Android. See GitHub repository,
or download free from Google Play Store.