public String encodeHex(String hexa){
      if(!hexa.matches("^[0-9a-fA-F]+$"))
          return "";

      List<Long> matched = new ArrayList<Long>();
      Matcher matcher = Pattern.compile("[\\w\\W]{1,12}").matcher(hexa);

      while (matcher.find())
          matched.add(Long.parseLong("1" + matcher.group(), 16));

      // conversion
      long[] result = new long[matched.size()];
      for(int i = 0; i < matched.size(); i++) result[i] = matched.get(i);

      return this._encode(result);
  }
public String encodeHex ( String hexa ) { if ( ! hexa . matches ( "^[0-9a-fA-F]+$" ) ) return "" ; List < Long > matched = new ArrayList < Long > ( ) ; Matcher matcher = Pattern . compile ( "[\\w\\W]{1,12}" ) . matcher ( hexa ) ; while ( matcher . find ( ) ) matched . add ( Long . parseLong ( "1" + matcher . group ( ) , 16 ) ) ; long [ ] result = new long [ matched . size ( ) ] ; for ( int i = 0 ; i < matched . size ( ) ; i ++ ) result [ i ] = matched . get ( i ) ; return this . _encode ( result ) ; }
Encrypt hexa to string

@param hexa the hexa to encrypt
@return the encrypt string