code: private static String formatByte(final byte[] pByte, final boolean pSpace, final boolean pTruncate) {
  		String result;
  		if (pByte == null) {
  			result = "";
  		} else {
  			int i = 0;
  			if (pTruncate) {
  				while (i < pByte.length && pByte[i] == 0) {
  					i++;
  				}
  			}
  			if (i < pByte.length) {
  				int sizeMultiplier = pSpace ? 3 : 2;
  				char[] c = new char[(pByte.length - i) * sizeMultiplier];
  				byte b;
  				for (int j = 0; i < pByte.length; i++, j++) {
  					b = (byte) ((pByte[i] & LEFT_MASK) >> 4);
  					c[j] = (char) (b > 9 ? b + CHAR_DIGIT_SEVEN : b + CHAR_DIGIT_ZERO);
  					b = (byte) (pByte[i] & RIGHT_MASK);
  					c[++j] = (char) (b > 9 ? b + CHAR_DIGIT_SEVEN : b + CHAR_DIGIT_ZERO);
  					if (pSpace) {
  						c[++j] = CHAR_SPACE;
  					}
  				}
  				result = pSpace ? new String(c, 0, c.length - 1) : new String(c);
  			} else {
  				result = "";
  			}
  		}
  		return result;
  	}
docs: Private method to format bytes to hexa string
  
  @param pByte
  the bytes to format
  @param pSpace
  true if add spaces between bytes
  @param pTruncate
  true to remove 0 left bytes value
  @return a string containing the requested string