Here you can find the source of toHexString(byte[] array)
Parameter | Description |
---|---|
array | The byte array which is to transformed into a hexadecimal string |
public static String toHexString(byte[] array)
//package com.java2s; /******************************************************************************* * Copyright (c) 2016 Dr.-Ing. Marc M?ltin. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors://from w w w. j a v a 2 s. c o m * Dr.-Ing. Marc M?ltin - initial API and implementation and initial documentation *******************************************************************************/ import javax.xml.bind.DatatypeConverter; public class Main { /** * Returns a hexadecimal string from a given byte array. * * @param array The byte array which is to transformed into a hexadecimal string * @return The hexadecimal string */ public static String toHexString(byte[] array) { if (array != null) return DatatypeConverter.printHexBinary(array); else return ""; } }