Name

int()

Description

Converts any value of a primitive data type (boolean, byte, char, color, float, int, or long) or String to its integer representation.

When an array of values is passed in, then an int array of the same length is returned.

Examples

  • float f = 65.0;
    int i = int(f);
    println(f + " : " + i);  // Prints "65.0 : 65"
    
    char c = 'E';
    i = int(c);
    println(c + " : " + i);  // Prints "E : 69"
    
Creative Commons License

This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.