reading from file and storing as integer
<p>i am trying to read from a file and store the data in three integers, red, green and blue
the data in the file is set as:</p>

<pre><code>255,0,0
0,255,0
0,0,255
0,255, 255
</code></pre>

<p>i have tried may methods of doing this but i am having no success could anyone help here is a copy of the method so far:</p>

<pre><code>private void readColoursFromFile()  {

    int red = 128;
    int green = 128;
    int blue = 128;

    StringBuilder contents = new StringBuilder();
    String filename = "colours.txt";
     try { 
    BufferedReader reader;

   reader = new BufferedReader(new FileReader(filename));
   String str;

   while (( str = reader.readLine()) != null) {

       StringTokenizer tokenizer = new StringTokenizer(str, ",");
       String rcolour = tokenizer.nextToken(); 
       String gcolour = tokenizer.nextToken(); 
       String bcolour = tokenizer.nextToken(); 
       Integer irColour = red;
       Integer igColour = green;
       Integer ibColour = blue;
       rcolour = Integer.toString(irColour);
       gcolour = Integer.toString(ibColour);
       bcolour = Integer.toString(igColour);
     contents.append(str);
       printColourRow(red, green, blue);    
       }
   {
     reader.close();
  }
   } catch (IOException e) {
    System.out.println("error");
    e.printStackTrace();
}
}
</code></pre>
