Q:

Find largest and smallest numbers number using Arrays

Trying to let users enter number of integers so I can set array length then find the max and min value. However, I can't find max and min. Please help.
import java.util.Scanner;
import java.util.Arrays;
public class ExerciseC{
    public static void main(String[] args){
        Scanner keyboard = new Scanner(System.in);
        System.out.println("Enter the number of integers you would like to enter:");
        int numberEnter = keyboard.nextInt();
        System.out.println("Enter some integers:");
        int integers = keyboard.nextInt();
        int numbers [] = new int [numberEnter];
        int maxValue = numbers[0];
        int minValue = numbers[0];
        int max = 0;
        int min = 0;
        for (int index = 1; index < numbers.length; index ++) {
            if (numbers[index] > maxValue) {
                maxValue = numbers [index];
            }
        }
        System.out.println("Print: " + maxValue);
        System.out.println("The difference between the largest and the smallest is: ");
    }

}

A:

You don't seem to be entering more then one value (and you never store integers in your array). Also, you aren't setting the min. I think you wanted
public static void main(String[] args) {
    Scanner keyboard = new Scanner(System.in);
    System.out.println("Number of integers to enter:");
    int numberEnter = keyboard.nextInt();
    int numbers[] = new int[numberEnter];
    int pos = 0;
    do {
        System.out.printf("Please enter integer #%d/%d:%n", pos, numberEnter);
        numbers[pos++] = keyboard.nextInt();
    } while (pos < numberEnter && keyboard.hasNextInt());
    int min = numbers[0];
    int max = numbers[0];
    for (pos = 1; pos < numbers.length; pos++) {
        if (numbers[pos] < min) { // <-- test min.
            min = numbers[pos];
        }
        if (numbers[pos] > max) { // <-- test max.
            max = numbers[pos];
        }
    }
    // Display everything.
    System.out.printf("%s Min: %d Max: %d%n", Arrays.toString(numbers),
            min, max);
}

