I'm trying to declare a long value in Java, which unfortunately does not work.
This is my code. It results in the following error message: "The literal 4294967296 of type int is out of range".
long bytes = 4294967296;
I need this value to make a file filter that filters out files that are bigger than 4294967296 bytes (4GB). The other way round works without any issues (long size = file.length()
) with every file size, which is why I can't figure out why my declaration is not working.
Add L
to the end of the number:
long bytes = 4294967296L;