This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes Alogrithm problem Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Alogrithm problem" Watch "Alogrithm problem" New topic
Author

Alogrithm problem

Lora Tully
Greenhorn

Joined: Nov 29, 2004
Posts: 8
Hi all. I am trying to implement this alogrithm to uncompress a compressed file I made...
/*
# Get one byte, put it to the output file, and now it's the 'last' byte.
# Loop
# Get one byte
# Is the current byte equal to last?
# Yes
* Now get another byte, this is 'counter'
* Put current byte in the output file
* Copy 'counter' times the 'last' byte to the output file
* Put last copied byte in 'last' (or leave it alone)
* Repeat.
# No
* Put current byte to the output file
* Now 'last' is the current byte
* Repeat
*/

This is the code I used for it...



And the loop never finishes and the pixelCount gets no way near the actual amount of pixels the program should be reading in. Can anyone see where I have went wrong. Thanks
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Alogrithm problem
 
Similar Threads
Picture Manipulation Methods
Reading and Writing from Large File, OutOfMemory
still stuck in database
Problems Adapting code
NX:[URLyBird]Get the correct field values