Compress String with Run Length Encoding in Java

In this Java example, we’re gonna know how to compress String in Java with Run Length Encoding (RLE) method.

Related Posts:
Java Regular Expression Overview – Syntax
Java Regular Expression to extract data from a Text
Java Regular Expression to mask information from a Text

Run Length Encoding

– RLE is a very simple form of data compression.
– It produces sequences in which the same data values occurs in data elements are stored as a single data value and a counter. For example, AAABB => 3A2B.
– RLE is suitable to use for:
+ palette-based bitmap images such as computer icons or
+ black points collection on a solid white background for example:



Encoding is very simple. For decoding, we use Regular Expression – Regex.


By grokonez | March 24, 2018.

Related Posts

Got Something To Say:

Your email address will not be published. Required fields are marked *