com.baidubce.services.iothisk.device.utils
Class ByteUtils

java.lang.Object
  extended by com.baidubce.services.iothisk.device.utils.ByteUtils

public class ByteUtils
extends Object

Provides byte array operation utilities


Constructor Summary
ByteUtils()
           
 
Method Summary
static byte[] getCounterBytes(long counter)
          Get byte array from counter value
static byte[] toBytesFromHex(String data)
          Get byte array from hex string
static byte[] toBytesFromInt(int number)
          Get byte array from int type value
static String toHexStringFromBytes(byte[] data)
          Get hex string from byte array
static long toLongFromBytes(byte[] data)
          Get long value from byte array
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ByteUtils

public ByteUtils()
Method Detail

toBytesFromHex

public static byte[] toBytesFromHex(String data)
Get byte array from hex string

Parameters:
data - specified hex string data
Returns:
byte array

toHexStringFromBytes

public static String toHexStringFromBytes(byte[] data)
Get hex string from byte array

Parameters:
data - specified byte array
Returns:
hex string

toBytesFromInt

public static byte[] toBytesFromInt(int number)
Get byte array from int type value

Parameters:
number - specified in type value
Returns:
byte array

toLongFromBytes

public static long toLongFromBytes(byte[] data)
Get long value from byte array

Parameters:
data - specified byte array
Returns:
successful long type value, otherwise an exception will be thrown

getCounterBytes

public static byte[] getCounterBytes(long counter)
Get byte array from counter value

Parameters:
counter - specified counter value
Returns:
successful byte value array, otherwise an exception will be thrown


Copyright © 2020. All rights reserved.