Runtime.getRuntime().maxMemory() is returning an estimate of the maximum heap size, not the total amount of memory that will be consumed by the entire process. Native memory, native libraries, etc. will contribute to the process size but not to maxMemory().