Here you can find the source of byteToString(int b)
Parameter | Description |
---|---|
b | the byte |
public static String byteToString(int b)
//package com.java2s; /*//from ww w.j ava 2 s.c om * This file is part of Gjokii. * * Gjokii is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Gjokii is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with Gjokii. If not, see <http://www.gnu.org/licenses/>. */ public class Main { /** * Convert a byte to a human readable representation * * @param b * the byte * @return the human readable representation */ public static String byteToString(int b) { String s = Integer.toHexString(b); if (s.length() == 1) s = "0" + s; else s = s.substring(s.length() - 2); return s; } }