I was benchmarking the total delay casting to datatype from Object will have. But I encountered a very weird behavior of a Java collection, in this case, a List.
List<Long> data = new ArrayList<>();
int SIZE = 50_000_000;
long currentTime = System.currentTimeMillis();
for (int i = 0; i < SIZE; i++) {
data.add(currentTime++);
}
When running the above code the CPU Utilization on my Intel i5 8250u (4 cores) the CPU utilization was 100% running on IntelliJ Idea. So I thought it could be because of IntelliJ, hence I move the code to Azure VM (running CentOS 7.4) having 20 Cores and to my surprise, this piece of code ended consuming 1500% CPU (result from top command) which is 15 cores.
What I'm not able to understand is this: How can a single-threaded Java program code consume more than 1 core?
EDIT:
Steps to Reproduce:
Run the above code.
Machine Configuration:
Laptop: 4 Cores 16Gb RAM, Oracle Java 1.8_161
Azure VM: 20 Cores 148GB RAM, Oracle Java 1.8_161
Output From JVisualVM on Laptop:


