This week's book giveaway is in the OCMJEA forum.
We're giving away four copies of OCM Java EE 6 Enterprise Architect Exam Guide and have Paul Allen & Joseph Bambara on-line!
See this thread for details.
The moose likes Java in General and the fly likes java decode help Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "java decode help" Watch "java decode help" New topic
Author

java decode help

miguel winzo
Greenhorn

Joined: Oct 10, 2010
Posts: 2
how could i fix this methodehich must accept a String consisting of a run-length encoding of a sequence of any characters except digit
characters ('0' - '9'), and return the corresponding
non-encodedString. In a run-length encoding each "run" which represent by the number of repetitions followed by the repeated character.

Examples:
"" is decoded as ""
"1a1b1c" is decoded as "abc"
"3a" is decoded as "aaa"
"3a2b4c" is decoded as "aaabbcccc"
"5x14y1z" is decoded as "xxxxxyyyyyyyyyyyyyyz"
public String decode(String es) {
pete stein
Bartender

Joined: Feb 23, 2007
Posts: 1561
miguel winzo wrote:how could i fix this methodehich must accept a String consisting of a run-length encoding of a sequence of any characters except digit
characters ('0' - '9'), and return the corresponding
non-encodedString. In a run-length encoding each "run" which represent by the number of repetitions followed by the repeated character.

Examples:
"" is decoded as ""
"1a1b1c" is decoded as "abc"
"3a" is decoded as "aaa"
"3a2b4c" is decoded as "aaabbcccc"
"5x14y1z" is decoded as "xxxxxyyyyyyyyyyyyyyz"
public String decode(String es) {

What method? Your post must not have worked as I only see a method fragment on the bottom.

Much luck and welcome to the ranch!
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19685
    
  20

String coder. Something tells me this is a school project and you're class mates


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
miguel winzo
Greenhorn

Joined: Oct 10, 2010
Posts: 2
lol we are i bet ..... and we looking for the same solution.
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 38519
    
  23
And welcome to JavaRanch
 
Don't get me started about those stupid light bulbs.
 
subject: java decode help