Reading a file into an array

hi, i'm pretty new to java and need a little help. i'm trying to produce a program to analyse text from a file. I' m thinking i need to read the file in question character at a time and store them in an array, which can then be passed as a parameter to other methods to calculate the number of printable characters etc. Is this the right way to do it or am i completely off course.

This is what i have, it complies ok but doesn't give the outcome is not what i was hoping for, any help would be apprieciated or if you can suggest another way of doing it.

import java.io.*;

import java.util.*;

import java.lang.*;

public class DraftTextAnalyzerTestV1

{

public static void main (String [] args)

{

try

{

FileReader importedFile = new FileReader ("fileread.txt"); //create FileReader object

BufferedReader textStream = new BufferedReader (importedFile);

int [] filedata = new int [300]; //array to hold unicode value of char

int ch; //holds int (uniCode) value of character

char c; //holds character after typecast from int

int counter = 0; //counts chars read so far

ch = textStream.read();

c = (char) ch; //typecast from int to char

System.out.println("/n");

// continue until end of file reached

for (int i = 0; i < filedata.length; i++)

{

System.out.println(""+ c); // disply next char

ch = textStream.read(); //read next char

filedata = textStream.read();

c = (char) ch;

System.out.println("filedata = "+filedata);// line to see filedata being populated

}

textStream.close();

}

catch (FileNotFoundException e)

{

System.out.println("no file read");

}

catch (IOException e)

{

System.out.println("problem reading file");

}

}

}

[1895 byte] By [nom@da] at [2007-11-27 3:14:07]
# 1
When you post code, please use[code] and [/code] tags as described in [url= http://forum.java.sun.com/help.jspa?sec=formatting ]Formatting tips[/url] on the message entry page. It makes it much easier to read.
PhHeina at 2007-7-12 8:16:37 > top of Java-index,Java Essentials,New To Java...