Are there any equivalents to size_t in C++ in Java?

c++, java, size-t

Solution

Java doesn't have unsigned types. But `long` in Java is 64-bit so it is definitely enough to be a `size_t`.

And, yes, for a bug free system, you can always watch out the unexpected case of negatives.

Problem

So I am VERY new to Java., but I actually really like it so far. I am comfortable in C++ and was trying to convert some of my code to learn more. I am stuck in translating my code at `size_t`. I know there are no unsigned integer types in Java, but could I use `long` instead? Would I just have to watch out for the case of negatives? Thank for the insight!

Original source