Here you can find the source of bytesToString(byte[] id)
Parameter | Description |
---|---|
id | some part of transaction id |
private static String bytesToString(byte[] id)
//package com.java2s; /**//from ww w . j av a2s. c om * Copyright 2015 Pozna? Supercomputing and Networking Center * * Licensed under the GNU General Public License, Version 3.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.gnu.org/licenses/gpl-3.0.txt * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ public class Main { /** * Hexadecimal digits. */ private static final String HEX_DIGITS = "0123456789ABCDEF"; /** * Returns a string representation of any part of transaction id. * * @param id * some part of transaction id * @return string representation */ private static String bytesToString(byte[] id) { StringBuffer sb = new StringBuffer(128); int value; for (byte b : id) { value = b & 0xff; sb.append(HEX_DIGITS.charAt(value / 16)); sb.append(HEX_DIGITS.charAt(value & 15)); } return sb.toString(); } }