Implement a Java program to sort an array of integers in ascending order.

Here’s a Java program to sort an array of integers in ascending order using the bubble sort algorithm:

import java.util.Scanner;

public class ArraySort {
    public static void main(String[] args) {
        int[] arr = new int[5];
        Scanner scanner = new Scanner(System.in);
        System.out.println("Enter 5 numbers: ");
        for (int i = 0; i < 5; i++) {
            arr[i] = scanner.nextInt();
        }
        bubbleSort(arr);
        System.out.println("Sorted array in ascending order: ");
        for (int i = 0; i < 5; i++) {
            System.out.print(arr[i] + " ");
        }
    }

    public static void bubbleSort(int[] arr) {
        int n = arr.length;
        for (int i = 0; i < n-1; i++) {
            for (int j = 0; j < n-i-1; j++) {
                if (arr[j] > arr[j+1]) {
                    int temp = arr[j];
                    arr[j] = arr[j+1];
                    arr[j+1] = temp;
                }
            }
        }
    }
}

In this program, we first create an integer array of size 5 and take user input for its elements using a for loop. We then call the `bubbleSort()` method to sort the array in ascending order.

The `bubbleSort()` method is an implementation of the bubble sort algorithm, which works by repeatedly swapping adjacent elements if they are in the wrong order. In the inner loop, we compare each element with the next element and swap them if necessary. After each iteration of the inner loop, the largest element is guaranteed to be at the end of the array. We repeat this process until the entire array is sorted.

At the end of the program, we print out the sorted array in ascending order using another for loop.