Java: are 1-d arrays always contiguous in memory?

No, the JVM specification does not have any such guarantees:
http://docs.oracle.com/javase/specs/jvms/se5.0/html/Concepts.doc.html#16446

In practice it is probably the case but you also have no guarantee about the word size.

Unsafe is not a standard Java class, so if your program uses this, then it is not portable anyway…

Leave a Comment