title: Convert Byte Array to Hexa Decimal String
body: <p>I have written a simple JSP LOGIN page. I have received password in encrypted format. I am decrypting it. So just for a try i am encrypting a sample string, so it needs to then encode byte array to Hexadecimal string, which i am trying to do in the last statement of my code.</p>
  
  <pre><code>&lt;%@ page import="java.sql.*" %&gt;
  &lt;%@ page import="java.io.*" %&gt;
  &lt;%@ page import="java.security.*" %&gt;
  &lt;%@ page import="javax.crypto.*" %&gt;
  &lt;%@ page import="javax.crypto.spec.*" %&gt;
  &lt;%@ page import="java.lang.*" %&gt;
  
  &lt;HTML&gt;
  &lt;HEAD&gt;
  &lt;TITLE&gt;Simple JSP/Oracle Query Example&lt;/TITLE&gt;
  &lt;/HEAD&gt;
  &lt;BODY&gt;
  
  &lt;%
     Class.forName("oracle.jdbc.OracleDriver");
  
     Connection conn = DriverManager.getConnection("jdbc:oracle:thin:@xxx:xxxx:xxxx","xxxxxx","xxxxxx");
                          // @//machineName:port:SID,   userid,  password
  
      Statement st=conn.createStatement();
  
      ResultSet rs=st.executeQuery("Select * from Cxxxxxxx");
  
      while(rs.next()){
          String name=rs.getString("user_id");
          String p=rs.getString("password");
          out.println(name+":"+p);
          out.println("&lt;/br&gt;");
  
  
      String algorithm1 = "DES";//magical mystery constant
      String algorithm2 = "DES/CBC/NoPadding";//magical mystery constant
      IvParameterSpec iv = new IvParameterSpec( new byte [] { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } );//magical mystery constant
      Cipher cipher;
      SecretKey key;
      String k="12345abc";
      key = new SecretKeySpec( k.getBytes("UTF-8"), algorithm1 );
      cipher = Cipher.getInstance( algorithm2 );
  
      String str="test4abc";
  
      cipher.init( Cipher.ENCRYPT_MODE, key, iv ); //normally you could leave out the IvParameterSpec argument, but not with Oracle
  
      byte[] bytes=str.getBytes("UTF-8");
  
      byte[] encrypted = cipher.doFinal( bytes );
  
      //Problem is in the statement BELOW ---&gt;
      String encoded = new String( Hex.encodeHex( encrypted ) );
      }
  %&gt;  
  &lt;/BODY&gt;
  &lt;/HTML&gt;
  </code></pre>
  
  <p>Error I am receiving is that:</p>
  
  <pre><code>[jsp src:line #:48]
  cannot resolve symbol symbol : variable Hex location: class _check1 String encoded = new String( Hex.encodeHex( encrypted ) ); 
  </code></pre>
  
  <p>How should I make this statement run or any other alternative to encode ByteArray to HexaDecimal String</p>