Android中获取CPU序列号
来源:互联网 发布:淘宝刷欢乐豆原理2017 编辑:程序博客网 时间:2024/06/06 07:47
/** * 获取CPU序列号 * * @return CPU序列号(16位) 读取失败为"0000000000000000" */ public static String getCPUSerial() { String str = "", strCPU = "", cpuAddress = "0000000000000000"; try { // 读取CPU信息 Process pp = Runtime. getRuntime().exec("cat/proc/cpuinfo"); InputStreamReader ir = new InputStreamReader(pp.getInputStream()); LineNumberReader input = new LineNumberReader(ir); // 查找CPU序列号 for ( int i = 1; i < 100; i++) { str = input.readLine(); if (str != null) { // 查找到序列号所在行 if (str.indexOf( "Serial") > -1) { // 提取序列号 strCPU = str.substring(str.indexOf(":" ) + 1, str.length()); // 去空格 cpuAddress = strCPU.trim(); break; } } else { // 文件结尾 break; } } } catch (IOException ex) { // 赋予默认值 ex.printStackTrace(); } return cpuAddress; }
0 0
- Android中获取CPU序列号
- Android中获取手机cpu序列号
- Android获取CPU序列号
- Android获取CPU序列号
- Android 获取cpu序列号
- android 获取CPU序列号
- android 获取CPU序列号
- VS中获取CPU序列号
- Android下如何获取CPU序列号
- Android下如何获取CPU序列号
- Android下如何获取CPU序列号
- ASP.NET中获取cpu序列号
- Qt中获取CPU的序列号
- 获取CPU序列号
- 获取cpu序列号
- 获取CPU序列号
- 获取cpu序列号
- 获取CPU序列号
- last -- 列出目前与过去登录系统的用户相关信息
- cf #327 Div.2 Problem B Rebranding
- ServletContext
- 机器学习算法学习三:K-means聚类
- putty教程以及plink的知识(转)
- Android中获取CPU序列号
- javascript 自定义进度条
- JavaWeb中实现资源跳转
- LoadRunner检查点使用小结
- Android学习——服务Service与广播接收者BroadcastReciver
- DiscreteSeekBar是一个Material Design风格的、带有气泡指示器的拖动条。可以自定义样式,非常不错的东西
- gct
- Tomcat、JBOSS、WebSphere、WebLogic、Apache之间的区别
- 严蔚敏 数据结构习题 C语言 4.10~4.13