This week's book giveaway is in the Jobs Discussion forum.
We're giving away four copies of Soft Skills and have John Sonmez 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 | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Java in General
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: 61755
    
  67

String.valueOf()


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by 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??