public static String toBinaryString(String inDecimalIp) throws InvalidIPAddressException {
		String[] ip = inDecimalIp.split("\\."); // Split string into array
		String binaryAddress = new String();

		for (int i = 0; i < ip.length; i++) {
			Integer octet = new Integer(ip[i].trim());

			// This tests every octet within the inDecimalIp
			// to make sure the user hasnt entered a Negative value.
			// This code fixs bug #1056000
			if (octet.intValue() < 0) {
				throw new InvalidIPAddressException("Invalid IP Address, cant use Negative IP address");
			}

			if (octet.intValue() <= 255) {

				StringBuffer temp = new StringBuffer(Integer.toBinaryString(octet.intValue()));
				if (temp.length() != 8) {

					while (temp.length() != 8) {
						temp.insert(0, 0);
					}
				}
				binaryAddress = binaryAddress + temp;
			} else
				throw new InvalidIPAddressException("Invalid IP Address");
		}

		return binaryAddress;
	}