Why not just create an ArrayList for example and pop each line into that,


ArrayList<String> myArrayList = new ArrayList<String>();
...
while( (data=bw.readLine()) != null) {
...