Here you can find the source of convertIPAdressToBytes(String ip)
static byte[] convertIPAdressToBytes(String ip)
//package com.java2s; /*/*from w w w . j ava 2s .c o m*/ * Copyright (c) 2014, 2017 ConteXtream Systems, Inc. and others. All rights reserved. * * This program and the accompanying materials are made available under the * terms of the Eclipse Public License v1.0 which accompanies this distribution, * and is available at http://www.eclipse.org/legal/epl-v10.html */ public class Main { static byte[] convertIPAdressToBytes(String ip) { String[] ipStr = ip.split("\\."); byte[] bytes = new byte[ipStr.length]; for (int i = 0; i < ipStr.length; i++) { bytes[i] = Integer.valueOf(ipStr[i], 10).byteValue(); } return bytes; } }