Printing the minuend and subtrahend in a Minimum Difference algorithm
Sorting

Arrays.sort(int[]) performs an in-array sorting, which may not be desirable if the caller of your method isn't expecting so. You may want to make a copy of the input via Arrays.copyOf(int[]) first.

Calculation

int temp = Math.abs(arr[i] - arr[i + 1]);
if (temp &lt; difference) /* ... */


Since you have sorted the array in ascending order, you have two possible approaches:


Leave temp as negative so that you're looking for the largest negative number, e.g. -1 to find the smallest difference.
Use arr[i + 1] - arr[i] so that the comparison afterwards can remain the same.


Using Math.abs() is therefore unnecessary.

Initializing values and array references

You treat arr.length = 1 differently from a multi-valued array when it comes to printing the value, but with some adjustment to how you initialize minuend and difference, you don't have to do so, e.g.:

int minuend = arr[0];
int difference = Integer.MAX;


In addition, consider storing just the difference and the array index where you have the smallest difference, so that you don't need to remember subtrahend.