×
Namespaces

Variants
Actions

System info in Java ME

From Nokia Developer Wiki
Jump to: navigation, search
Article Metadata
Article
Created: reflexus@ig.com.br (08 Oct 2011)
Last edited: hamishwillee (22 Jul 2013)

This java code fragment shows you how to get system information including the J2ME platform, total memory and used memory.

private void sysInfo() {
Runtime runtime;
long l1 = ((runtime = Runtime.getRuntime()).totalMemory() + 512L) / 1024L;
long l2 = (runtime.freeMemory() + 512L) / 1024L;
String s = "System info\n";
s += "J2ME platform: " + System.getProperty("microedition.platform") + "\n";
s += "Total memory: " + l1 + " KBytes\n";
s += "Used memory: " + (l1 - l2) + " KBytes\n";
System.out.println(s);
}

Tip.pngTip: The platform information can be uninformative. Some handsets return a string giving detailed information about the vendor and model, but unfortunately there are many that just return the generic string "j2me", which tells you nothing.

This page was last modified on 22 July 2013, at 11:34.
53 page views in the last 30 days.

Was this page helpful?

Your feedback about this content is important. Let us know what you think.

 

Thank you!

We appreciate your feedback.

×