All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.gateway.utils.ByteUtils Maven / Gradle / Ivy

 
package com.gateway.utils;

import java.util.concurrent.atomic.AtomicInteger;

public class ByteUtils {

	

	/**
	 * byte16
	 *
	 * @param src
	 * @return
	 */
	public static String bytesToHexString(byte[] src) {
		StringBuilder stringBuilder = new StringBuilder();
		if (src == null || src.length <= 0) {
			return null;
		}
		for (int i = 0; i < src.length; i++) {
			int v = src[i] & 0xFF;
			String hv = Integer.toHexString(v);
			if (hv.length() < 2) {
				stringBuilder.append(0);
			}
			stringBuilder.append(hv);
		}
		return stringBuilder.toString();
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy