public static BCF2Type determineIntegerType(final int[] values) { // find the min and max values in the array int max = 0, min = 0; for ( final int v : values ) { if ( v > max ) max = v; if ( v < min ) min = v; } final BCF2Type maxType = determineIntegerType(max); final BCF2Type minType = determineIntegerType(min); // INT8 < INT16 < INT32 so this returns the larger of the two return maxType.compareTo(minType) >= 0 ? maxType : minType; }
public static BCF2Type determineIntegerType(final int[] values) { // find the min and max values in the array int max = 0, min = 0; for ( final int v : values ) { if ( v > max ) max = v; if ( v < min ) min = v; } final BCF2Type maxType = determineIntegerType(max); final BCF2Type minType = determineIntegerType(min); // INT8 < INT16 < INT32 so this returns the larger of the two return maxType.compareTo(minType) >= 0 ? maxType : minType; }
@Ensures("result.isIntegerType()") public static BCF2Type determineIntegerType(final int[] values) { // find the min and max values in the array int max = 0, min = 0; for ( final int v : values ) { if ( v > max ) max = v; if ( v < min ) min = v; } final BCF2Type maxType = determineIntegerType(max); final BCF2Type minType = determineIntegerType(min); // INT8 < INT16 < INT32 so this returns the larger of the two return maxType.compareTo(minType) >= 0 ? maxType : minType; }