This week's book giveaway is in the Agile and other Processes forum.
We're giving away four copies of The Mikado Method and have Ola Ellnestam and Daniel Brolund on-line!
See this thread for details.
The moose likes Java in General and the fly likes converting int to String using toString()  ?? possible?? Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Java » Java in General
Reply Bookmark "converting int to String using toString()  ?? possible??" Watch "converting int to String using toString()  ?? possible??" New topic
Author

converting int to String using toString() ?? possible??

akash negi
Greenhorn

Joined: Feb 24, 2010
Posts: 27
Hi all, I am trying to write this program to compress a sequence using RLE compression.


for example--
wwwerrrrrttttttttttt will be 3we5r11t



However, in the code I am getting an error

toString() in java.lang.Object cannot be applied to (int)



I am using toString() because of this..toString()







comp = comp + toString(counter) + uncomp.charAt(pos);
counter = 1;
}
}


comp = comp + toString(counter) + uncomp.charAt(pos);
counter = 1;



basically I am trying to convert an int value to String. So that it can be concatenated to another string.


Please help..
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 56185
    
  13

String.valueOf()


[Smart Questions] [JSP FAQ] [Books by Bear] [Bear's FrontMan] [About Bear]
akash negi
Greenhorn

Joined: Feb 24, 2010
Posts: 27
thanks for that

however, not the program has logical errors.

for:

eeeer - e4r; which should be 4er
tttyyyuuui - tyu7i; which is completely off..

any help on correcting that..

I wrote 3 other progs. altogether and am a little confused.

Thanks.
akash negi
Greenhorn

Joined: Feb 24, 2010
Posts: 27
Never mind.. I figured that out.. the else if statement was not neccessary..


Thanks..
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: converting int to String using toString() ?? possible??
 
Similar Threads
Parsing words
need help with compareTo()
[Easy] Shift String
Knuth Morris Pratt Search Algorithm Help
Equals Method problem