Coverage Report - org.apache.archiva.checksum.Hex
 
Classes in this File Line Coverage Branch Coverage Complexity
Hex
0%
0/9
0%
0/2
1.5
 
 1  
 package org.apache.archiva.checksum;
 2  
 
 3  
 /**
 4  
  * Hex - simple hex conversions. 
 5  
  *
 6  
  * @version $Id: Hex.java 645362 2008-04-07 04:08:30Z joakime $
 7  
  */
 8  0
 public class Hex
 9  
 {
 10  0
     private static final byte[] DIGITS = "0123456789abcdef".getBytes();
 11  
 
 12  
     public static String encode( byte[] data )
 13  
     {
 14  0
         int l = data.length;
 15  
 
 16  0
         byte[] raw = new byte[l * 2];
 17  
 
 18  0
         for ( int i = 0, j = 0; i < l; i++ )
 19  
         {
 20  0
             raw[j++] = DIGITS[( 0xF0 & data[i] ) >>> 4];
 21  0
             raw[j++] = DIGITS[0x0F & data[i]];
 22  
         }
 23  
 
 24  0
         return new String( raw );
 25  
     }
 26  
 
 27  
     public static String encode( String raw )
 28  
     {
 29  0
         return encode( raw.getBytes() );
 30  
     }
 31  
 
 32  
 }