Please note that as of October 24, 2014, the Nokia Developer Wiki will no longer be accepting user contributions, including new entries, edits and comments, as we begin transitioning to our new home, in the Windows Phone Development Wiki. We plan to move over the majority of the existing entries over the next few weeks. Thanks for all your past and future contributions.

System info in Java ME

From Wiki
Jump to: navigation, search
Article Metadata
Created: (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";

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.
32 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.