'CPU, RAM stress android

I have a task to compare the performance of Java and Kotlin programs. I would like to measure CPU memory and RAM usage. I read somewhere that a good idea for CPU stress is to generate random numbers and sort them, however I have a problem how to stress RAM. What is the ways can to stress CPU and RAM in android?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source