| %line | %branch | |||||||||
|---|---|---|---|---|---|---|---|---|---|---|
| net.sf.mindoro.commons.util.StringUtils |
|
|
| 1 | /* |
|
| 2 | * Created on Jun 6, 2005 |
|
| 3 | * |
|
| 4 | * StringUtils provides a set of utility functions for dealing with Strings |
|
| 5 | */ |
|
| 6 | package net.sf.mindoro.commons.util; |
|
| 7 | ||
| 8 | /** |
|
| 9 | * StringUtils provides a set of utility functions for dealing with Strings |
|
| 10 | * |
|
| 11 | * @author aisrael |
|
| 12 | */ |
|
| 13 | public final class StringUtils { |
|
| 14 | ||
| 15 | /** |
|
| 16 | * Instances of StringUtils should NOT be constructed in regular |
|
| 17 | * programming. |
|
| 18 | */ |
|
| 19 | 0 | private StringUtils() { |
| 20 | // noop |
|
| 21 | 0 | } |
| 22 | ||
| 23 | 6 | private static final char[] HEXTABLE = new class="keyword">char[] { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', |
| 24 | 'a', 'b', 'c', 'd', 'e', 'f' }; |
|
| 25 | ||
| 26 | /** |
|
| 27 | * @param bytes |
|
| 28 | * byte[] |
|
| 29 | * @return String |
|
| 30 | */ |
|
| 31 | public static String toHex(final byte[] bytes) { |
|
| 32 | 16 | final StringBuffer sb = new StringBuffer(bytes.length * 2); |
| 33 | 424 | for (int i = 0; i < bytes.length; ++i) { |
| 34 | 408 | sb.append(HEXTABLE[(bytes[i] & 0xF0) >> 4]).append(HEXTABLE[bytes[i] & 0x0F]); |
| 35 | } |
|
| 36 | 16 | return sb.toString(); |
| 37 | } |
|
| 38 | ||
| 39 | } |
| This report is generated by jcoverage, Maven and Maven JCoverage Plugin. |