Created
December 2, 2020 13:42
-
-
Save zhugw/f969d92459f2bbbf81b5fd1fc0e13423 to your computer and use it in GitHub Desktop.
FooTest
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Created by zhuguowei on 2020/12/2. | |
*/ | |
public class FooTest { | |
public void display1(int a, int b, int c) { | |
String val1 = getAValue(a); | |
String val2 = getBValue(b); | |
String val3 = getCValue(c); | |
System.out.println(val1 + " " + val2 + " " + val3); | |
} | |
public void display2(int a, int b, int c) { | |
if (a % 2 == 0 && b % 3 == 0 && c % 4 == 0) { | |
System.out.println("show a show b show c"); | |
} else if (a % 2 == 0 && b % 3 == 0 && c % 4 != 0) { | |
System.out.println("show a show b hide c"); | |
} else if (a % 2 == 0 && b % 3 != 0 && c % 4 != 0) { | |
System.out.println("show a show b hide c"); | |
} else if (a % 2 == 0 && b % 3 != 0 && c % 4 == 0) { | |
System.out.println("show a show b hide c"); | |
} else if (a % 2 != 0 && b % 3 == 0 && c % 4 == 0) { | |
System.out.println("show a show b hide c"); | |
} else if (a % 2 != 0 && b % 3 == 0 && c % 4 != 0) { | |
System.out.println("show a show b hide c"); | |
} else if (a % 2 != 0 && b % 3 != 0 && c % 4 == 0) { | |
System.out.println("show a show b hide c"); | |
} else if (a % 2 != 0 && b % 3 != 0 && c % 4 != 0) { | |
System.out.println("show a show b hide c"); | |
} | |
} | |
private String getCValue(int c) { | |
if (c % 4 == 0) { | |
return "show c"; | |
} else { | |
return "hide c"; | |
} | |
} | |
private String getBValue(int b) { | |
if (b % 3 == 0) { | |
return "show b"; | |
} else { | |
return "hide b"; | |
} | |
} | |
private String getAValue(int a) { | |
if (a % 2 == 0) { | |
return "show a"; | |
} else { | |
return "hide a"; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment