what data structure should I use to store binary codes in java?

arrays, binary, image-compression, java, string

Solution

`java.util.BitSet` is designed for that if the length is not fixed.

Problem

I have binary codes as 10111 , 100011, 11101111 etc. now what data structure should I use to store these codes so that minimum size is required to store them? I can't use string array as size required will be more as compared than storing the decimal equivalent of above binary codes.

Original source