is Jvm 64 bit - Java Java Virtual Machine

Java examples for Java Virtual Machine:JVM

Description

is Jvm 64 bit

Demo Code


//package com.java2s;

public class Main {
    public static void main(String[] argv) throws Exception {
        System.out.println(isJvm64bit());
    }//  w  w  w. j  av  a  2s .c o  m

    public static boolean isJvm64bit() {
        String[] astring = new String[] { "sun.arch.data.model",
                "com.ibm.vm.bitmode", "os.arch" };
        String[] astring1 = astring;
        int i = astring.length;
        for (int j = 0; j < i; ++j) {
            String s = astring1[j];
            String s1 = System.getProperty(s);
            if (s1 != null && s1.contains("64")) {
                return true;
            }
        }
        return false;
    }
}

Related Tutorials