Java code: [/B] [Code]/**
* Obtain the CPU serial number
*
* @ Return CPU serial number (16 bits)
* Failed to read: "0000000000000000"
*/
Public static string getcpuserial (){
String STR = "", strcpu = "", cpuaddress = "0000000000000000 ";
Try {
// Read CPU Information
Process pp = runtime.getruntime(cmd.exe C ("cat/proc/cpuinfo ");
Inputstreamreader IR = new inputstreamreader (pp. getinputstream ());
Linenumberreader input = new linenumberreader (IR );
// Search for the CPU serial number
For (INT I = 1; I <100; I ++ ){
STR = input. Readline ();
If (STR! = NULL ){
// Find the row where the serial number is located
If (Str. indexof ("serial")>-1 ){
// Extract the serial number
Strcpu = Str. substring (Str. indexof (":") + 1,
Str. Length ());
// Remove space
Cpuaddress = strcpu. Trim ();
Break;
}
} Else {
// End of the file
Break;
}
}
} Catch (ioexception ex ){
// Assign the default value
Ex. printstacktrace ();
}
Return cpuaddress;
}