Example usage for com.google.common.primitives UnsignedBytes parseUnsignedByte

List of usage examples for com.google.common.primitives UnsignedBytes parseUnsignedByte

Introduction

In this page you can find the example usage for com.google.common.primitives UnsignedBytes parseUnsignedByte.

Prototype

@Beta
public static byte parseUnsignedByte(String string) 

Source Link

Document

Returns the unsigned byte value represented by the given decimal string.

Usage

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;
}