Total amount of memory in Java virtual machine
import java.text.DecimalFormat;
public class Main {
public static void main(String[] args) {
DecimalFormat df = new DecimalFormat("0.00");
long totalMem = Runtime.getRuntime().totalMemory();
System.out.println(df.format(totalMem / 1000000F) + " MB");
}
}
Home
Java Book
Runnable examples
Java Book
Runnable examples
System:
- Copy and paste string to and from System Clipboard
- Copy and paste image to and from System Clipboard
- Alert when Losting Clipboard owner
- System beeper
- Beep by printing the ASCII Bell character to the console
- Total amount of memory in Java virtual machine
- Maximum amount of memory in Java virtual machine
- Free amount of memory in Java Virtual Machine
- Environment variables