Here you can find the source of toEvenLengthHex(BigInteger value)
public static String toEvenLengthHex(BigInteger value)
//package com.java2s; /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ import java.math.BigInteger; public class Main { /**//w w w . j a va 2 s. c om * Convert a big integer into hex string. If the length is not even, add an * '0' character in the beginning to make it even. */ public static String toEvenLengthHex(BigInteger value) { String result = value.toString(16); if (result.length() % 2 != 0) { result = "0" + result; } return result; } }