Java Can not Cast from String to Integer_Sovled

FlameLink

New Member
\[code\]HashMap<String, String> config = Feeds.config; String num = config.get("NumOfFeeds");System.out.println(num);feedsAmount = ((Integer)num).intValue();System.out.println(feedsAmount);\[/code\]I've also tried \[code\]Integer.parseInt(num)\[/code\] and \[code\]Integer.decode(num)\[/code\] and \[code\]Integer.valueof(bu)\[/code\]Results as follows: 40\[code\]Exception in thread "main" java.lang.NumberFormatException: For input string:"40"at java.lang.NumberFormatException.forInputString(NumberFormatException.java:48)at java.lang.Integer.parseInt(Integer.java:458)at java.lang.Integer.parseInt(Integer.java:499)at fetch_RSS.<init>(fetch_RSS.java:40)at testing.main(testing.java:27)\[/code\]The problem was caused by different encoding from the txt file I'm reading from and the encoding in Elipse which is the macRoman by default.
 
Top