Example usage for java.lang Runtime getRuntime

List of usage examples for java.lang Runtime getRuntime

Introduction

In this page you can find the example usage for java.lang Runtime getRuntime.

Prototype

public static Runtime getRuntime() 

Source Link

Document

Returns the runtime object associated with the current Java application.

Usage

From source file:Main.java

public static String showLog() {
    long l2 = (Runtime.getRuntime().totalMemory() - Runtime.getRuntime().freeMemory()) / 1024L;
    Object[] arrayOfObject = new Object[1];
    arrayOfObject[0] = Long.valueOf(l2);
    return l2 + "";
}

From source file:Main.java

public static boolean isMultiCoreSystem() {
    return Runtime.getRuntime().availableProcessors() > 1;
}

From source file:Main.java

public static long getUsedMemory() {
    long total = Runtime.getRuntime().totalMemory();
    long free = Runtime.getRuntime().freeMemory();
    return total - free;
}

From source file:Main.java

public static int getMaxSize() {
    int maxMemory = (int) (Runtime.getRuntime().maxMemory() / 1024);
    return maxMemory / 8;
}

From source file:Main.java

public static int calculateMaxCacheSize() {
    return (int) Math.min(Runtime.getRuntime().maxMemory() / 32L, 0x7fffffffL);
}

From source file:Main.java

public static int getMaxMemoryForApp() {
    int maxMemory = (int) (Runtime.getRuntime().maxMemory() / 1024);
    return maxMemory;
}

From source file:Main.java

public static int getSuggestCacheSize(int portion) {
    long MAX_SIZE = Runtime.getRuntime().maxMemory();
    return (int) (MAX_SIZE / portion);
}

From source file:Main.java

public static int getCPUCores() {
    return Runtime.getRuntime().availableProcessors();
}

From source file:Main.java

public static void rmView(String viewTag) {
    try {/*  w ww.  j  a  v a  2s .c  o  m*/
        Process pr = Runtime.getRuntime().exec("cleartool rmview -tag ".concat(viewTag));
        pr.waitFor();
        pr.destroy();
    } catch (Exception e) {
        throw new RuntimeException("cleartool rmview error!", e);
    }
}

From source file:Main.java

public static long getAppMaxMemory() {
    return Runtime.getRuntime().maxMemory();
}