I Have used a byte Array like this:
byte[] fileContents = Files.readAllBytes(path);
for(int i = 0 ,j = 1; i <fileContents.length ; i++)
FileContents += Integer.toBinaryString(fileContents[i]);
System.out.println(FileContents);
but when I run this on a File containing :
Ananay
it shows this:
java.lang.NullPointerException
at java.lang.String.replace(String.java:2239)
at UEX.<init>(UEX.java:21)
at test.testEncryption(test.java:38)
at __SHELL54.run(__SHELL54.java:5)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at bluej.runtime.ExecServer$3.run(ExecServer.java:743)
Thanks in advance.
(I prefer to use a String in this case even though it is not recommended)