Here's a Java program to implement the Selection Sort algorithm:

public class SelectionSort {

public static void selectionSort(int[] arr) {

int n = arr.length;

// One by one move boundary of unsorted subarray

for (int i = 0; i < n - 1; i++) {

// Find the minimum element in unsorted array

int minIndex = i;

for (int j = i + 1; j < n; j++) {

if (arr[j] < arr[minIndex]) {

minIndex = j;



// Swap the found minimum element with the first element

int temp = arr[minIndex];

arr[minIndex] = arr[i];

arr[i] = temp;



public static void printArray(int[] arr) {

for (int value : arr) {

System.out.print(value + " ");




public static void main(String[] args) {

int[] arr = {64, 25, 12, 22, 11};

System.out.println("Original array:");



System.out.println("Sorted array:");




This program defines a method `selectionSort` that takes an array of integers as input and sorts it using the Selection Sort algorithm. It iterates through the array, finds the minimum element in the unsorted portion of the array, and swaps it with the first element of the unsorted portion. This process is repeated until the entire array is sorted.

The `printArray` method is used to print the elements of the array. In the `main` method, an example array is initialized, sorted using the `selectionSort` method, and then printed before and after sorting.