Example usage for java.lang Float MAX_VALUE

List of usage examples for java.lang Float MAX_VALUE

Introduction

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

Prototype

float MAX_VALUE

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

Click Source Link

Document

A constant holding the largest positive finite value of type float , (2-2-23)·2127.

Usage

From source file:Main.java

public static void main(String[] args) {
    System.out.println("MAX_VALUE:" + Float.MAX_VALUE);
}

From source file:Main.java

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

From source file:MainClass.java

public static void main(String args[]) {
    try {/*from ww  w . j a  v a2 s. com*/

        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: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: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:MaxVariablesDemo.java

public static void main(String args[]) {

    //integers/*from   w  w  w  .j a v  a2  s.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:DataTypePrintTest.java

public static void main(String[] args) {

    Thread objectData = new Thread();
    String stringData = "Java Mania";
    char[] charArrayData = { 'a', 'b', 'c' };
    int integerData = 4;
    long longData = Long.MIN_VALUE;
    float floatData = Float.MAX_VALUE;
    double doubleData = Math.PI;
    boolean booleanData = true;

    System.out.println(objectData);
    System.out.println(stringData);
    System.out.println(charArrayData);
    System.out.println(integerData);
    System.out.println(longData);
    System.out.println(floatData);
    System.out.println(doubleData);
    System.out.println(booleanData);
}

From source file:MaxVariablesDemo.java

public static void main(String args[]) {

    // integers//from w  w  w .  java  2s. co  m
    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

public static float fmin(final float... values) {
    float min = Float.MAX_VALUE;
    for (final float v : values) {
        min = Math.min(v, min);//from www.  j a  va 2s .co m
    }
    return min;
}

From source file:Main.java

/**
 * Transform all array values from its current min, max range to a, b range
 *
 * @param array array to transform//  w  ww.  j av a  2 s  . c o  m
 * @param a     new minimum value of array
 * @param b     new maximum value of array
 * @return transformed array
 */
public static float[] linearTransform(float[] array, float a, float b) {
    /* determine current min, max values */
    float min = Float.MAX_VALUE;
    float max = Float.MIN_VALUE;
    for (int i = 0; i < array.length; i++) {
        if (array[i] < min)
            min = array[i];
        if (array[i] > max)
            max = array[i];
    }

    /* linear transformation of matrix values from [min,max] -> [a,b] */
    for (int i = 0; i < array.length; i++) {
        array[i] = a + (b - a) * (array[i] - min) / (max - min);
    }

    return array;
}