Here you can find the source of toHexString(byte bytes[])
Parameter | Description |
---|---|
bytes | The checksum as an array of bytes |
private static String toHexString(byte bytes[])
//package com.java2s; /**/* w w w.j ava 2s . c o m*/ * Project Wonderland * * Copyright (c) 2004-2009, Sun Microsystems, Inc., All Rights Reserved * * Redistributions in source code form must reproduce the above * copyright and this condition. * * The contents of this file are subject to the GNU General Public * License, Version 2 (the "License"); you may not use this file * except in compliance with the License. A copy of the License is * available at http://www.opensource.org/licenses/gpl-license.php. * * Sun designates this particular file as subject to the "Classpath" * exception as provided by Sun in the License file that accompanied * this code. */ public class Main { /** * Converts the checksum given as an array of bytes into a hex-encoded * string. * * @param bytes The checksum as an array of bytes * @return The checksum as a hex-encoded string */ private static String toHexString(byte bytes[]) { StringBuffer ret = new StringBuffer(); for (int i = 0; i < bytes.length; ++i) { ret.append(Integer.toHexString(0x0100 + (bytes[i] & 0x00FF)).substring(1)); } return ret.toString(); } }