List of usage examples for com.google.common.primitives UnsignedBytes parseUnsignedByte
@Beta public static byte parseUnsignedByte(String string)
From source file:org.opendaylight.openflowplugin.extension.vendor.nicira.convertor.match.MatchUtil.java
public static Long ipv4ToLong(Ipv4Address ipv4) { Iterator<String> iterator = SPLITTER.split(ipv4.getValue()).iterator(); byte[] bytes = new byte[8]; for (int i = 0; i < bytes.length; i++) { if (i < 4) { bytes[i] = 0;/*from ww w . j a v a 2 s.co m*/ } else { bytes[i] = UnsignedBytes.parseUnsignedByte((iterator.next())); } } Long result = Longs.fromByteArray(bytes); return result; }