hi
I have text file with 65536 hex words (0,5MB) in sdcard (simulator)
and i am trying to read it like this:
but this completly freezing my simulator for a few minutes. Is there any better way to get this values?
later in code when i am reading this string array containing file i use:
String value = sbox1[y]; //string[] array with file
wynik=Integer.valueOf(value, 16).intValue();
return w;
I have text file with 65536 hex words (0,5MB) in sdcard (simulator)
Code:
13FC, ECFD, E842, EBD7, 959D, 11E4, EF68, 7BCB, 2B72, 33C5, 1271, 8053, 9608, 3A82, A766, B80A, ...
Code:
String[] loadFile(final String f) {
String thisLine;
String help[] = null;
final List<String> s = new ArrayList<String>();
BufferedReader br = null;
try {
br = new BufferedReader(new FileReader(f));
while ((thisLine = br.readLine()) != null){
help=thisLine.split(",");
for(int i=0;i<16;i++){
s.add(help[i]);
}}
} catch (IOException ioe) {
System.err.println("Error reading file " + f);
throw new RuntimeException(ioe);
} finally {
if(br!=null) try {
br.close();
} catch (IOException e) {
e.printStackTrace();
}
}
return s.toArray(new String[s.size()]);
}
later in code when i am reading this string array containing file i use:
String value = sbox1[y]; //string[] array with file
wynik=Integer.valueOf(value, 16).intValue();
return w;