So in terms of bytes we have to start out with typical memory usage.

Now again this is very dependent on machine and implementation but

these numbers are reasonable and are found on typical implementations.

So a boolean, it would be nice if a boolean just took a bit, because it's just

true or false, but actually usually we have to count for a byte for a boolean.

One byte is a byte, character nowadays is 2 bytes, 16 bit characters.

Not that long ago, we used 8 bits for chars.

Integer, a regular int is 4.

Bytes or 32 bits and float is also 4 bytes, long int is 8 and a double is 8.

Usually we use doubles for a floating point and ints for

integers in most applications.

So that's for primitive types.

And then for arrays there is a certain amount of overhead for making an array and

then if there's N items it's whatever the cost of the primitive type times N.

So, in array of doubles is say 8N + 24.

And two-dimensional array.

Then well, we can go ahead and compute the exact thing,

but now it's time to use the tilde notation.

Even for arrays, we could say a double is tilde 8N, for one-dimensional.

For two-dimensional, two-dimensional array of doubles is tilde 8 M N.

And there's extra terms for the overhead but for

large M and N that's going to be pretty accurate.

So that's our basic usage for primitive types and

arrays in a typical job implementation.