I’m working with audio files in java (Assignment in my laboratory), and i read bytes from file then i convert them to primitive data types int and short. As i know primitive data types depend on compile settings and operating system. So how they depend on ? Are there immutable data types in java ? (i mean data types those don’t depend on operating system and compile settings)
>Solution :
Java primitives data types are not OS dependent.
These are the values for those types, and they are always the same.
| Type | Bytes | Range |
|---|---|---|
byte |
1 | -128 to 127 |
short |
2 | -32,768 to 32,767 |
int |
4 | -2,147,483,648 to 2,147,483,647 |
You can find out more about them here
How data is stored in files might be a different topic.