helpppppp how do i convert primitives in a string to int

here s my code i ve got the numbers i grabed them in a string if their s another way plz tell me its driveing me nuts

public class readingfiles2 extends Applet

{

int dumyvar = 0;

String dumystring = " ";

public void init()

{

try{

URL url = new URL(getCodeBase(), "Myvectors.txt");

InputStream instream = url.openStream();

BufferedReader in = new BufferedReader(new InputStreamReader(instream));

dumystring = in.readLine();

dumyvar = (Integer)dumystring;//this doesnt work

}

catch(IOException e){}

}

public void paint(Graphics g)

{

g.drawString(" the int "+dumyvar,30,30);

g.drawString(" the str "+dumystring,30,50);

}

}

[790 byte] By [xlightwavex] at [2007-9-26 3:01:41]
# 1
very simple:dumyvar = Integer.parseInt(dumystring );
firedigger at 2007-6-29 11:00:00 > top of Java-index,Archived Forums,New To Java Technology Archive...
# 2
better way:try{dumyvar = Integer.parseInt(dumystring );}catch(NumbrFormatException e){System.out.println("not a number!");}
firedigger at 2007-6-29 11:00:00 > top of Java-index,Archived Forums,New To Java Technology Archive...
# 3
An even better way would be using a binary file and reading primitives with DataInputStream.readInt().
jsalonen at 2007-6-29 11:00:00 > top of Java-index,Archived Forums,New To Java Technology Archive...
# 4
thank u gentlemen much appreciated
xlightwavex at 2007-6-29 11:00:00 > top of Java-index,Archived Forums,New To Java Technology Archive...