Here you can find the source of ipv4ToBytes(String ipv4)
public static byte[] ipv4ToBytes(String ipv4)
//package com.java2s; //License from project: Apache License public class Main { public static byte[] ipv4ToBytes(String ipv4) { String[] groups = ipv4.split("\\."); byte[] ret = new byte[4]; for (int i = 0; i < 4; i++) { ret[i] = (byte) Integer.parseInt(groups[i]); }/*from ww w . j av a 2 s. com*/ return ret; } }