Example usage for java.lang Short MAX_VALUE

List of usage examples for java.lang Short MAX_VALUE

Introduction

In this page you can find the example usage for java.lang Short MAX_VALUE.

Prototype

short MAX_VALUE

To view the source code for java.lang Short MAX_VALUE.

Click Source Link

Document

A constant holding the maximum value a short can have, 215-1.

Usage

From source file:Main.java

public static void main(String args[]) {
    System.out.println("Max value from Short class:" + Short.MAX_VALUE);
}

From source file:Main.java

public static void main(String[] args) {
    System.out.println(Short.MIN_VALUE);
    System.out.println(Short.MAX_VALUE);
}

From source file:ShortsVsInts.java

public static void main(String[] unused) {
    short i, j;//from   w  w w. jav  a 2 s.  c om
    i = 30;
    j = ++i; // works
    j += 1; // works
    j += 32768; // compiles; truncates at run time!
    System.out.println(j);
    System.out.println(Short.MAX_VALUE);
    //j = j + 1;   // won't compile
}

From source file:Main.java

public static void main(String[] args) {
    System.out.println("Byte.MIN = " + Byte.MIN_VALUE);
    System.out.println("Byte.MAX = " + Byte.MAX_VALUE);
    System.out.println("Short.MIN = " + Short.MIN_VALUE);
    System.out.println("Short.MAX = " + Short.MAX_VALUE);
    System.out.println("Integer.MIN = " + Integer.MIN_VALUE);
    System.out.println("Integer.MAX = " + Integer.MAX_VALUE);
    System.out.println("Long.MIN = " + Long.MIN_VALUE);
    System.out.println("Long.MAX = " + Long.MAX_VALUE);
    System.out.println("Float.MIN = " + Float.MIN_VALUE);
    System.out.println("Float.MAX = " + Float.MAX_VALUE);
    System.out.println("Double.MIN = " + Double.MIN_VALUE);
    System.out.println("Double.MAX = " + Double.MAX_VALUE);
}

From source file:Main.java

public static void main(String args[]) {

    System.out.println("Min byte value   = " + Byte.MIN_VALUE);
    System.out.println("Max byte value   = " + Byte.MAX_VALUE);
    System.out.println("Min short value  = " + Short.MIN_VALUE);
    System.out.println("Max short value  = " + Short.MAX_VALUE);
    System.out.println("Min int value    = " + Integer.MIN_VALUE);
    System.out.println("Max int value    = " + Integer.MAX_VALUE);
    System.out.println("Min float value  = " + Float.MIN_VALUE);
    System.out.println("Max float value  = " + Float.MAX_VALUE);
    System.out.println("Min double value = " + Double.MIN_VALUE);
    System.out.println("Max double value = " + Double.MAX_VALUE);
}

From source file:MainClass.java

public static void main(String args[]) {
    try {//  w  ww. j a  v a2  s  . c o m

        FileOutputStream fos = new FileOutputStream(args[0]);

        DataOutputStream dos = new DataOutputStream(fos);

        dos.writeBoolean(false);
        dos.writeByte(Byte.MAX_VALUE);
        dos.writeChar('A');
        dos.writeDouble(Double.MAX_VALUE);
        dos.writeFloat(Float.MAX_VALUE);
        dos.writeInt(Integer.MAX_VALUE);
        dos.writeLong(Long.MAX_VALUE);
        dos.writeShort(Short.MAX_VALUE);

        fos.close();
    } catch (Exception e) {
        System.out.println("Exception: " + e);
    }
}

From source file:MaxVariablesDemo.java

public static void main(String args[]) {

    //integers/*  w  w w.  ja v a 2s  . c  om*/
    byte largestByte = Byte.MAX_VALUE;
    short largestShort = Short.MAX_VALUE;
    int largestInteger = Integer.MAX_VALUE;
    long largestLong = Long.MAX_VALUE;

    //real numbers
    float largestFloat = Float.MAX_VALUE;
    double largestDouble = Double.MAX_VALUE;

    //other primitive types
    char aChar = 'S';
    boolean aBoolean = true;

    //Display them all.
    System.out.println("The largest byte value is " + largestByte + ".");
    System.out.println("The largest short value is " + largestShort + ".");
    System.out.println("The largest integer value is " + largestInteger + ".");
    System.out.println("The largest long value is " + largestLong + ".");

    System.out.println("The largest float value is " + largestFloat + ".");
    System.out.println("The largest double value is " + largestDouble + ".");

    if (Character.isUpperCase(aChar)) {
        System.out.println("The character " + aChar + " is uppercase.");
    } else {
        System.out.println("The character " + aChar + " is lowercase.");
    }
    System.out.println("The value of aBoolean is " + aBoolean + ".");
}

From source file:MaxVariablesDemo.java

public static void main(String args[]) {

    // integers/* ww w .  j av  a2s  .com*/
    byte largestByte = Byte.MAX_VALUE;
    short largestShort = Short.MAX_VALUE;
    int largestInteger = Integer.MAX_VALUE;
    long largestLong = Long.MAX_VALUE;

    /* real numbers*/
    float largestFloat = Float.MAX_VALUE;
    double largestDouble = Double.MAX_VALUE;

    // other primitive types
    char aChar = 'S';
    boolean aBoolean = true;

    // display them all
    System.out.println("The largest byte value is " + largestByte);
    System.out.println("The largest short value is " + largestShort);
    System.out.println("The largest integer value is " + largestInteger);
    System.out.println("The largest long value is " + largestLong);

    System.out.println("The largest float value is " + largestFloat);
    System.out.println("The largest double value is " + largestDouble);

    if (Character.isUpperCase(aChar)) {
        System.out.println("The character " + aChar + " is upper case.");
    } else {
        System.out.println("The character " + aChar + " is lower case.");
    }
    System.out.println("The value of aBoolean is " + aBoolean);
}

From source file:Main.java

protected static void do_shorts() {
    short i = Short.MAX_VALUE;
    System.out.println("i=" + i++);
    System.out.println("i=" + i++);
    System.out.println("i=" + i++);
}

From source file:Main.java

public static void setSizes(Component comp, Dimension dim) {
    comp.setMinimumSize(dim);//from  w w w  .j a  va 2 s.c o  m
    comp.setPreferredSize(dim);
    comp.setMaximumSize(new Dimension(Short.MAX_VALUE, (int) comp.getPreferredSize().getHeight()));
}