Here you can find the source of bytesToString(byte[] b)
Parameter | Description |
---|---|
b | the array to be processed. |
public static String bytesToString(byte[] b)
//package com.java2s; /*//from ww w . j a va 2 s.c o m * $Id$ * * Copyright (c) 2008-2014 David Muller <roxon@users.sourceforge.net>. * All rights reserved. Use of the code is allowed under the * Artistic License 2.0 terms, as specified in the LICENSE file * distributed with this code, or available from * http://www.opensource.org/licenses/artistic-license-2.0.php */ public class Main { /** * Produces a string prepresentation of the byte array. * * @param b the array to be processed. * * @return A string representation of the byte array. */ public static String bytesToString(byte[] b) { StringBuffer sb; sb = new StringBuffer(); sb.append("{ "); for (int ii = 0; ii < b.length; ++ii) { if (ii > 0) { sb.append(", "); } sb.append(b[ii]); } sb.append(" }"); return sb.toString(); } }