Here you can find the source of hashCodeToString(byte[] hash)
Parameter | Description |
---|---|
hash | The bytes. |
private static String hashCodeToString(byte[] hash)
//package com.java2s; /************************************************************************** * * Gluewine Core Module//w w w . ja v a 2 s. co m * * Copyright (C) 2013 FKS bvba http://www.fks.be/ * * Licensed under the Apache License, Version 2.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.apache.org/licenses/LICENSE-2.0 * * 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 { /** * Converts the given bytes to a hex String. * * @param hash The bytes. * @return The String. */ private static String hashCodeToString(byte[] hash) { StringBuffer sb = new StringBuffer(""); for (int i = 0; i < hash.length; i++) sb.append(Integer.toString((hash[i] & 0xff) + 0x100, 16).substring(1)); return sb.toString(); } }