獲取八位UUID標識碼

           public static String[] chars = new String[]
                {
                    "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z",
                    "0", "1", "2", "3", "4", "5", "6", "7", "8", "9",
                    "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z"
                };

            public static String getShortUuid() {
              StringBuffer stringBuffer = new StringBuffer();
              String uuid = UUID.randomUUID().toString().replace("-", "");
              for (int i = 0; i < 8; i++) {
                String str = uuid.substring(i * 4, i * 4 + 4);
                int strInteger = Integer.parseInt(str, 16);
                stringBuffer.append(chars[strInteger % 0x3E]);
              }

              return stringBuffer.toString();
            }

          posted on 2016-01-19 15:17 Mr.lu 閱讀(3382) 評論(0)  編輯  收藏


          只有注冊用戶登錄后才能發表評論。


          網站導航:
           
          <2016年1月>
          272829303112
          3456789
          10111213141516
          17181920212223
          24252627282930
          31123456

          導航

          統計

          常用鏈接

          留言簿(2)

          隨筆檔案

          文章檔案

          搜索

          最新評論

          閱讀排行榜

          評論排行榜

          主站蜘蛛池模板: 弋阳县| 济南市| 兴城市| 尖扎县| 鹤峰县| 虎林市| 呼伦贝尔市| 习水县| 那曲县| 绥宁县| 布尔津县| 五寨县| 遂平县| 宣汉县| 上思县| 沂水县| 临漳县| 当阳市| 托里县| 西乌珠穆沁旗| 六枝特区| 渭源县| 夏河县| 科技| 托里县| 容城县| 苏州市| 望奎县| 永安市| 大埔区| 宾阳县| 鄂尔多斯市| 五家渠市| 肥城市| 澜沧| 福州市| 盐源县| 静海县| 如东县| 定安县| 台南市|