public final void refresh() { RT = Runtime.getRuntime(); txtMaxMem.setText(Long.toString(RT.maxMemory() / 1048576)); txtTotalMem.setText(Long.toString(RT.totalMemory() / 1048576)); this.txtUsedMem.setText(Long.toString((RT.totalMemory() - RT.freeMemory()) / 1048576)); this.txtStorage.setText( new DecimalFormat(".000").format(WorkDir.getUsableSpace() / 1000000000F)); this.lblFolder.setText(WorkDir.getAbsolutePath()); }
public static String memoryToString() { DecimalFormat fmt = new DecimalFormat("0.0"); return "Memory: " + fmt.format(RUNTIME.maxMemory() / 1048576D) + "MByte maximum, " + fmt.format(RUNTIME.totalMemory() / 1048576D) + "MByte total, " + fmt.format(RUNTIME.totalMemory() / 1048576D) + "MByte free"; }