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

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

Introduction

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

Prototype

@Beta
@CheckReturnValue
public static String toString(byte x) 

Source Link

Document

Returns a string representation of x, where x is treated as unsigned.

Usage

From source file:org.opendaylight.openflowplugin.extension.vendor.nicira.convertor.match.MatchUtil.java

public static Ipv4Address longToIpv4Address(Long l) {
    byte[] bytes = Longs.toByteArray(l);
    String[] strArray = new String[4];
    for (int i = 4; i < bytes.length; i++) {
        strArray[i - 4] = UnsignedBytes.toString(bytes[i]);
    }/*from  ww w  .j  a va  2  s.c  om*/
    String str = JOINER.join(strArray);
    Ipv4Address result = new Ipv4Address(str);
    return result;
}