Class SystemUtils


  • public class SystemUtils
    extends java.lang.Object
    System utilities.
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      private SystemUtils()
      Private constructor to ensure that the class acts as a true utility class i.e.
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static int getJavaMajorVersion()
      Parses the "java.version" system property and returns the first digit of the version number of the Java Runtime Environment (e.g.
      static int getJavaMinorVersion()
      Parses the "java.version" system property and returns the second digit of the version number of the Java Runtime Environment (e.g.
      static int getJavaUpdateVersion()
      Parses the "java.version" system property and returns the update release number of the Java Runtime Environment (e.g.
      static int hashCode​(java.lang.Object... objects)
      Computes the hash code of a set of objects.
      static boolean isWindows()
      Indicates if the current operating system is in the Windows family.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • SystemUtils

        private SystemUtils()
        Private constructor to ensure that the class acts as a true utility class i.e. it isn't instantiable and extensible.
    • Method Detail

      • getJavaMajorVersion

        public static int getJavaMajorVersion()
        Parses the "java.version" system property and returns the first digit of the version number of the Java Runtime Environment (e.g. "1" for "1.3.0").
        Returns:
        The major version number of the Java Runtime Environment.
        See Also:
        Official Java versioning
      • getJavaMinorVersion

        public static int getJavaMinorVersion()
        Parses the "java.version" system property and returns the second digit of the version number of the Java Runtime Environment (e.g. "3" for "1.3.0").
        Returns:
        The minor version number of the Java Runtime Environment.
        See Also:
        Official Java versioning
      • getJavaUpdateVersion

        public static int getJavaUpdateVersion()
        Parses the "java.version" system property and returns the update release number of the Java Runtime Environment (e.g. "10" for "1.3.0_10").
        Returns:
        The release number of the Java Runtime Environment or 0 if it does not exist.
        See Also:
        Official Java versioning
      • hashCode

        public static int hashCode​(java.lang.Object... objects)
        Computes the hash code of a set of objects. Follows the algorithm specified in List.hasCode().
        Parameters:
        objects - the objects to compute the hashCode
        Returns:
        The hash code of a set of objects.
      • isWindows

        public static boolean isWindows()
        Indicates if the current operating system is in the Windows family.
        Returns:
        True if the current operating system is in the Windows family.