Here you can find the source of ipv4StringToByteArrayUnchecked(String str)
public static byte[] ipv4StringToByteArrayUnchecked(String str)
//package com.java2s; /*// w w w. j a v a2s. c o m * * Copyright (C) 2014 Ruediger Gad * * This file is part of clj-net-pcap. * * clj-net-pcap is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License (LGPL) as * published by the Free Software Foundation, either version 3 of the License, * or (at your option) any later version. * * clj-net-pcap is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License (LGPL) for more details. * * You should have received a copy of the GNU Lesser General Public License (LGPL) * along with clj-net-pcap. If not, see <http://www.gnu.org/licenses/>. * */ public class Main { public static byte[] ipv4StringToByteArrayUnchecked(String str) { byte[] ret = new byte[4]; String[] s = str.split("\\."); for (int i = 0; i < ret.length; i++) { ret[i] = (byte) Integer.parseInt(s[i], 10); } return ret; } }