Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Memory size of a String Array storing binary codes

I want to store a list of binary codes in a String[] array, such as in the following example...

String[] str={"10001", "100101","101010101"};

How much memory is required to store the array?

like image 309
nitin Avatar asked Feb 28 '26 13:02

nitin


1 Answers

You will find here the following result:

Minimum String memory usage (bytes) = 8 * (int) ((((no chars) * 2) + 45) / 8)

like image 191
Jaco Van Niekerk Avatar answered Mar 03 '26 02:03

Jaco Van Niekerk



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!