The Lab Book Pages

An online collection of electronics information

http://www.labbookpages.co.uk

Dr. Andrew Greensted
Last modified: 1st September 2010

Hide Menu


Valid XHTML Valid CSS
Valid RSS VIM Powered
RSS Feed Icon

This site uses Google Analytics to track visits. Privacy Statement

Page Icon

Miscellaneous


Java Primitives

Type Bit Width Minimum Maximum Default
boolean - false true false
byte 8-bit signed integer -(27) -128 27-1 127 0
char 16-bit unicode 2.0 character 0 216-1 65 535 \0000
short 16-bit signed integer -(215) -32 768 215-1 32 767 0
int 32-bit signed integer -(231) -2 147 483 648 231-1 2 147 483 467 0
long 64-bit signed integer -(263) -9 223 372 036 854 775 808 263-1 9 223 372 036 854 775 807 0l
float 32-bit signed floating-point java.lang.Float.NEGATIVE_INFINITY java.lang.Float.POSITIVE_INFINITY 0.0f
double 64-bit signed floating-point java.lang.Double.NEGATIVE_INFINITY java.lang.Double.POSITIVE_INFINITY 0.0d

Time

The maximum time, in ms, that can be stored in different types:

short:215 ms(32 sec 767 ms)
int:231 ms(24 days, 20 hours, 31 minutes, 23 sec 648 ms)
long:263 ms(Years!!)

Set Default GUI Font

The snippet below get be used to set the default Java GUI font. It works, but there may be a better way

javax.swing.plaf.FontUIResource f = new javax.swing.plaf.FontUIResource("Dialog",Font.PLAIN,10);

java.util.Enumeration keys = UIManager.getDefaults().keys();

while (keys.hasMoreElements())
{
  Object key = keys.nextElement();
  Object value = UIManager.get (key);
  if (value instanceof javax.swing.plaf.FontUIResource) UIManager.put (key, f);
}

Jars

File: manifest
Main-Class: MainClass
> jar -cfm stuff.jar manifest -C class stuff
export CLASSPATH="/java/stuff.jar"
> java stuff.MainClass

Book Logo