Class SystemHelper


  • @Immutable
    public final class SystemHelper
    extends Object
    Get information about the system we're running on.
    Author:
    Philip Helger
    • Method Detail

      • getNumberOfProcessors

        @Nonnegative
        public static int getNumberOfProcessors()
        Returns:
        The number of processors the computer has.
      • getProcessorArchitecture

        @Nonnull
        public static EProcessorArchitecture getProcessorArchitecture()
        Returns:
        The current processor architecture and never null.
      • getOperatingSystem

        @Nonnull
        public static EOperatingSystem getOperatingSystem()
        Returns:
        The operating system we're running on.
      • getOperatingSystemName

        @Nonnull
        public static String getOperatingSystemName()
        Returns:
        The name and version of the operating system we're running on.
      • getJavaVersion

        @Nonnull
        public static EJavaVersion getJavaVersion()
        Returns:
        The current Java version that is running. Never null.
      • getJVMVendor

        @Nonnull
        public static EJVMVendor getJVMVendor()
        Returns:
        The vendor of the Java Virtual Machine (JVM) that we're operating on.
      • getSystemLocale

        @Nonnull
        public static Locale getSystemLocale()
        Returns:
        The system locale.
      • getSystemCharset

        @Nonnull
        public static Charset getSystemCharset()
        Returns:
        The system charset.
      • getSystemCharsetName

        @Nonnull
        public static String getSystemCharsetName()
        Returns:
        The name of the system charset.
      • getFreeMemory

        @Nonnegative
        public static long getFreeMemory()
        Returns the amount of free memory in the Java Virtual Machine.
        Returns:
        an approximation to the total amount of memory currently available for future allocated objects, measured in bytes.
      • getMaxMemory

        @Nonnegative
        public static long getMaxMemory()
        Returns the maximum amount of memory that the Java virtual machine will attempt to use. If there is no inherent limit then the value Long.MAX_VALUE will be returned.
        Returns:
        the maximum amount of memory that the virtual machine will attempt to use, measured in bytes
      • getTotalMemory

        @Nonnegative
        public static long getTotalMemory()
        Returns the total amount of memory in the Java virtual machine. The value returned by this method may vary over time, depending on the host environment.

        Note that the amount of memory required to hold an object of any given type may be implementation-dependent.

        Returns:
        the total amount of memory currently available for current and future objects, measured in bytes.