I want to read the test.txt file as byte, not int. But, it cannot cast int c to byte [] d. Or, I do not need to use int c to read the whole file? Pls advise.
May be following code help you byte[] b; try{ File f = new File("c:/abc.txt"); int length = (int)f.length(); b = new byte[length]; FileInputStream fin = new FileInputStream(f); DataInputStream din = new DataInputStream(fin); din.read(b); }catch(Exception ex){}
Just don't try do it in one line of code: EncryptClass o = new EncryptClass(is.read(bytes)); You need to use two lines: is.read(bytes); EncryptClass o = new EncryptClass(bytes));