@@ -0,0 +1,826 @@
+package org.optimization;%0A%0A/**%0A * %E4%BD%BF%E7%94%A8%E5%B1%80%E9%83%A8%E5%8F%98%E9%87%8F%E5%AF%B9%E5%A5%BD%E5%A4%84%EF%BC%8C%E8%B0%83%E7%94%A8%E6%96%B9%E6%B3%95%E6%97%B6%E4%BC%A0%E9%80%92%E7%9A%84%E5%8F%82%E6%95%B0%E5%8F%8A%E5%9C%A8%E8%B0%83%E7%94%A8%E4%B8%AD%E5%88%9B%E5%BB%BA%E7%9A%84%E4%B8%B4%E6%97%B6%E6%A0%87%E4%BA%AE%E9%83%BD%E4%BF%9D%E5%AD%98%E5%9C%A8%E6%A0%88%E4%B8%AD%EF%BC%8C%E9%80%9F%E5%BA%A6%E8%BE%83%E5%BF%AB%E3%80%82%0A * %E5%85%B6%E5%AE%83%E5%8F%98%E9%87%8F%EF%BC%8C%E5%A6%82%E9%9D%99%E6%80%81%E5%8F%98%E9%87%8F%EF%BC%8C%E5%AE%9E%E4%BE%8B%E5%8F%98%E9%87%8F%E7%AD%89%EF%BC%8C%E9%83%BD%E5%9C%A8%E5%A0%86%E4%B8%AD%E5%88%9B%E5%BB%BA%EF%BC%8C%E9%80%9F%E5%BA%A6%E8%BE%83%E6%85%A2%E3%80%82%0A *%0A * @author shijingui on 2018/1/6%0A */%0Apublic class LocalVar %7B%0A    static int a;%0A%0A    public static void main(String%5B%5D args) %7B%0A%0A        long st = System.currentTimeMillis();%0A        useGlobalVar();%0A        System.out.println(%22static var cost:%22 + (System.currentTimeMillis() - st) + %22ms%22);%0A        st = System.currentTimeMillis();%0A        useLocalVar();%0A        System.out.println(%22local var cost:%22 + (System.currentTimeMillis() - st) + %22ms%22);%0A    %7D%0A%0A%0A    public static void useLocalVar() %7B%0A        int b = 0;%0A        for (int i = 0; i %3C 100000000; i++) %7B%0A            b++;%0A        %7D%0A    %7D%0A%0A    public static void useGlobalVar() %7B%0A        for (int i = 0; i %3C 100000000; i++) %7B%0A            a++;%0A        %7D%0A%0A    %7D%0A%0A%0A%7D%0A

add ref