use switch instead of ifs

This commit is contained in:
Mathis Chenuet
2015-03-04 18:53:40 +00:00
committed by Laurent Clouet
parent 40de3e150d
commit c3064de5e9

View File

@@ -70,14 +70,19 @@ public class CPU {
public void generateArch() {
String arch = System.getProperty("os.arch").toLowerCase();
if (arch.equals("i386") || arch.equals("i686") || arch.equals("x86")) {
this.arch = "32bit";
}
else if (arch.equals("amd64") || arch.equals("x86_64")) {
this.arch = "64bit";
}
else {
this.arch = null;
switch (arch) {
case "i386":
case "i686":
case "x86":
this.arch = "32bit";
break;
case "amd64":
case "x86_64":
this.arch = "64bit";
break;
default:
this.arch = null;
break;
}
}