Created
February 20, 2015 13:19
-
-
Save AKB428/8460ce8ab81815f47074 to your computer and use it in GitHub Desktop.
Javaのfor最適化は意味あるか否か
This file contains hidden or 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
| public class OptimizeForLoop { | |
| public static void main(String[] args) { | |
| noOptimize(args); | |
| optimize(args); | |
| } | |
| public static void noOptimize(String[] args) { | |
| for (int i = 0; i < args.length; i++) { | |
| System.out.println(args[i]); | |
| } | |
| } | |
| public static void optimize(String[] args) { | |
| for (int i = 0, n = args.length; i < n; i++) { | |
| System.out.println(args[i]); | |
| } | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment