package com.m4gik.util;

/**
 * A collection of utility methods used throughout this project. This class
 * mainly contains method for implementing the operations of presenting data.
 * 
 * @author Michał Szczygieł <michal.szczygiel@wp.pl>
 * 
 */
public class Util {

    /**
     * Base-64 chars.
     */
    private static final String BASE64_CHARS = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz./";

    /**
     * Base-64 charset.
     */
    private static final char[] BASE64_CHARSET = BASE64_CHARS.toCharArray();

    /**
     * Hex charset.
     */
    private static final char[] HEX_DIGITS = "0123456789ABCDEF".toCharArray();

    /**
     * Trivial constructor to enforce Singleton pattern.
     */
    private Util() {
        super();
    }

}

@@ -261,17 +261,16 @@
  Util %7B%0A
-%0A
     /**%0A
@@ -276,29 +276,27 @@
 %0A     * 
-Base-64
+Hex
  chars
+et
 .%0A     *
@@ -326,26 +326,24 @@
 nal 
-String BASE64_CHAR
+char%5B%5D HEX_DIGIT
 S = 
@@ -363,292 +363,2221 @@
 CDEF
-GHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz./%22;%0A%0A    /**%0A     * Base-64 charset.%0A     */%0A    private static final char%5B%5D BASE64_CHARSET = BASE64_CHARS.toCharArray();%0A%0A    /**%0A     * Hex charset.%0A     */%0A    private static final char%5B%5D HEX_DIGITS = %220123456789ABCDEF%22.toCharArray();
+%22.toCharArray();%0A%0A    /**%0A     * This method checks if given string contains hex value.%0A     * %0A     * @param hexValue%0A     *            the value to check if is hexadecimal representation.%0A     * @return the given hex value.%0A     * @throws Exception%0A     */%0A    private static String checkHexValue(String hexValue) %7B%0A        try %7B%0A            Long.parseLong(hexValue, 16);%0A        %7D catch (Exception ex) %7B%0A            throw new NumberFormatException(%0A                    %22This value is not hexadecimal representation!%22);%0A        %7D%0A%0A        return hexValue;%0A    %7D%0A%0A    /**%0A     * Returns a string of hexadecimal digits from a byte array. Each byte is%0A     * converted to 2 hex symbols; zero(es) included.%0A     * %3Cp%3E%0A     * This method calls the method with same name and three arguments as:%0A     * %0A     * %3Cpre%3E%0A     * toString(ba, 0, ba.length);%0A     * %3C/pre%3E%0A     * %0A     * @param ba%0A     *            the byte array to convert.%0A     * @return a string of hexadecimal characters (two for each byte)%0A     *         representing the designated input byte array.%0A     */%0A    public static String toString(byte%5B%5D ba) %7B%0A        return toString(ba, 0, ba.length);%0A    %7D%0A%0A    /**%0A     * Returns a string of hexadecimal digits from a byte array, starting at%0A     * %3Ccode%3Eoffset%3C/code%3E and consisting of %3Ccode%3Elength%3C/code%3E bytes. Each%0A     * byte is converted to 2 hex symbols; zero(es) included.%0A     * %0A     * @param ba%0A     *            the byte array to convert.%0A     * @param offset%0A     *            the index from which to start considering the bytes to%0A     *            convert.%0A     * @param length%0A     *            the count of bytes, starting from the designated offset to%0A     *            convert.%0A     * @return a string of hexadecimal characters (two for each byte)%0A     *         representing the designated input byte sub-array.%0A     */%0A    public static final String toString(byte%5B%5D ba, int offset, int length) %7B%0A        char%5B%5D buf = new char%5Blength * 2%5D;%0A        for (int i = 0, j = 0, k; i %3C length;) %7B%0A            k = ba%5Boffset + i++%5D;%0A            buf%5Bj++%5D = HEX_DIGITS%5B(k %3E%3E%3E 4) & 0x0F%5D;%0A            buf%5Bj++%5D = HEX_DIGITS%5Bk & 0x0F%5D;%0A        %7D%0A        return checkHexValue(new String(buf));%0A    %7D
 %0A%0A  

Implement basic method to conversion from hex to string.