org.jutil
Class TRuntime

java.lang.Object
  extended by org.jutil.TRuntime

public final class TRuntime
extends java.lang.Object

This is the TAssert utility code class.


Field Summary
static int SIZEOF_INT
          SIZEOF_INT, convienence variable representing the size of an int (4)
static int SIZEOF_K
          Convienence variable representing the size of an kilobyte (1024)
static int SIZEOF_LONG
          Convienence variable representing the size of an long (8)
static int SIZEOF_MEG
          Convienence variable representing the size of a megabyte (1024*1024)
 
Constructor Summary
TRuntime()
          Ensure that no one can create instances of this Class.
 
Method Summary
static java.lang.String formatAsK(int i)
          Convienence method for formatting as kilobytes e.g.
static java.lang.String formatAsK(long l)
          Convienence method for formatting as kilobytes e.g.
static java.lang.String formatAsK(java.lang.Number n)
          Convienence method for formatting as kilobytes e.g.
static java.lang.String formatAsMB(int i)
          Convienence method for formatting as megabytes e.g.
static java.lang.String formatAsMB(long bytes)
          Convienence method for formatting as megabytes e.g.
static java.lang.String formatAsMB(java.lang.Number bytes)
          Convienence method for formatting as megabytes e.g.
static long getFreeMem()
          USAGE: org.jutil.TRuntime.getFreeMem();
static float getJavaVersion()
           
static float getMemFreeAsPercent()
          USAGE: org.jutil.TRuntime.getMemFreeAsPercent();
static float getMemUsedAsPercent()
          USAGE: org.jutil.TRuntime.getMemUsedAsPercent();
static java.lang.String getSystemState()
          USAGE: org.jutil.TRuntime.getSystemState();
static long getTotalMem()
          USAGE: org.jutil.TRuntime.getTotalMem();
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SIZEOF_INT

public static final int SIZEOF_INT
SIZEOF_INT, convienence variable representing the size of an int (4)

Usage:

 System.out.println("Size of int == " +org.jutil.TRuntime.SIZEOF_INT);

See Also:
Constant Field Values

SIZEOF_LONG

public static final int SIZEOF_LONG
Convienence variable representing the size of an long (8)

Usage:

 System.out.println("Size of long == " +org.jutil.TRuntime.SIZEOF_LONG);

See Also:
Constant Field Values

SIZEOF_K

public static final int SIZEOF_K
Convienence variable representing the size of an kilobyte (1024)

Usage:

 System.out.println("Size of kilobyte == " +org.jutil.TRuntime.SIZEOF_K);

See Also:
Constant Field Values

SIZEOF_MEG

public static final int SIZEOF_MEG
Convienence variable representing the size of a megabyte (1024*1024)

Usage:

 System.out.println("Size of megabyte == " +org.jutil.TRuntime.SIZEOF_MEG);

1MB=1048576, 2MB=2097152, 5MB=5242880, 10MB=10485760, 50MB=52428800

See Also:
Constant Field Values
Constructor Detail

TRuntime

public TRuntime()
Ensure that no one can create instances of this Class.

Method Detail

getSystemState

public static final java.lang.String getSystemState()
USAGE: org.jutil.TRuntime.getSystemState();


getTotalMem

public static final long getTotalMem()
USAGE: org.jutil.TRuntime.getTotalMem();


getFreeMem

public static final long getFreeMem()
USAGE: org.jutil.TRuntime.getFreeMem();


getMemUsedAsPercent

public static final float getMemUsedAsPercent()
USAGE: org.jutil.TRuntime.getMemUsedAsPercent();


getMemFreeAsPercent

public static final float getMemFreeAsPercent()
USAGE: org.jutil.TRuntime.getMemFreeAsPercent();


formatAsK

public static final java.lang.String formatAsK(int i)
Convienence method for formatting as kilobytes e.g. 1k

Usage:

 System.out.println("mem == " +org.jutil.TRuntime.formatAsK(1024);

Parameters:
i - - int value to format

formatAsMB

public static final java.lang.String formatAsMB(int i)
Convienence method for formatting as megabytes e.g. 10MB

Usage:

 System.out.println("mem == " +org.jutil.TRuntime.formatAsMB(1048576));

Parameters:
i - - int value to format

formatAsK

public static final java.lang.String formatAsK(long l)
Convienence method for formatting as kilobytes e.g. 1k

Usage:

 System.out.println("mem == " +org.jutil.TRuntime.formatAsK(1500l));

Parameters:
i - - long value to format

formatAsMB

public static final java.lang.String formatAsMB(long bytes)
Convienence method for formatting as megabytes e.g. 10MB

Usage:

 System.out.println("mem == " +org.jutil.TRuntime.formatAsMB(1048576l));

Parameters:
i - - long value to format

formatAsK

public static final java.lang.String formatAsK(java.lang.Number n)
Convienence method for formatting as kilobytes e.g. 1k

Usage:

 System.out.println("mem == " +org.jutil.TRuntime.formatAsK(new Long(1024)));

Parameters:
i - - Number value to format

formatAsMB

public static final java.lang.String formatAsMB(java.lang.Number bytes)
Convienence method for formatting as megabytes e.g. 10MB

Usage:

 System.out.println("mem == " +org.jutil.TRuntime.formatAsMB(new Long(1048576l)));

Parameters:
i - - Number value to format

getJavaVersion

public static final float getJavaVersion()