Is integer size in java of fixed length or variable size?
ex: 1 or 10000 does both the number takes same space during allocation?
It depends on the JVM implementation.
In typical implementations, boolean, byte, char, short and int will be 32-bits always on the stack while long will be 64-bits on the stack. In typical implementations bytes, chars, shorts, ints and longs will be their "native" size in arrays (that is, 8, 16, 16, 32 and 64-bit respectively).
In typical implementations the size of integers within structures will be their native size if alignment allows it.
It's certainly possible that some very unusual implementations could use variable length integers for structures, or even on the stack or in arrays (but that's even harder to imagine and more obscure) - but I certainly haven't seen any that do.