Advertisement
teknoraver

java 32 or 64

Jul 27th, 2015
321
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.72 KB | None | 0 0
  1. import java.io.BufferedReader;
  2. import java.io.FileReader;
  3. import java.io.IOException;
  4. import java.util.StringTokenizer;
  5.  
  6. public class detect
  7. {
  8.     private static boolean is64() throws IOException
  9.     {
  10.         BufferedReader in = new BufferedReader(new FileReader("/proc/cpuinfo"));
  11.         String line = null;
  12.         while((line = in.readLine()) != null) {
  13.             if(line.startsWith("flags   ")) {
  14.                 StringTokenizer flags = new StringTokenizer(line, " ");
  15.                 while(flags.hasMoreTokens())
  16.                     if(flags.nextToken().equals("lm"))
  17.                         return true;
  18.                 break;
  19.             }
  20.         }
  21.         return false;
  22.     }
  23.  
  24.     public static void main(String args[]) throws IOException
  25.     {
  26.         if(is64())
  27.             System.out.println("64");
  28.         else
  29.             System.out.println("32");
  30.     }
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement