Hello
I want the hex code of files for which I am using the following functions
public static String displayBinaryFile2(File f) throws IOException
{
String hex="";
String hex2="";
BufferedInputStream in = new BufferedInputStream(new FileInputStream(f));
int b,i=0,c=0;
int count=0;
while ((b = in.read()) != -1) { c++;
try {
hex=Integer.toHexString(b);
hex2=hex2+hex;
} catch(Exception e){System.out.println("Example5.java"+e);}
//System.out.println("HEX2:"+hex2);
if (hex.length() == 1)
hex = '0' + hex;
} //end of func
in.close();
return hex2;
This code works fine for small files. But for large files, the console through which I run my GUI becomes unresponsive.
Can anyone suggest a better hexadecimal conversion method ?