Here you can find the source of bytesToHexString(byte[] _bytes)
Parameter | Description |
---|---|
_bytes | a parameter |
public static String bytesToHexString(byte[] _bytes)
//package com.java2s; //License from project: Open Source License public class Main { private static final char[] hexChars = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f' }; /**//www . j a va2 s. com * Wandelt das ggb. ByteArray in einen HexString um * * @param _bytes * @return */ public static String bytesToHexString(byte[] _bytes) { StringBuffer sb = new StringBuffer(); for (int i = 0; i < _bytes.length; i++) { byte b = _bytes[i]; if ((b < 0) || (b > 0xf)) { sb.append(Integer.toHexString(b & 0xFF)); } else { sb.append('0'); sb.append(hexChars[b]); } } return sb.toString(); } }