Sorting an unsorted array
While this code works as intended, there is room for improvement.

Use small functions that do one thing

The main method does too many things:


Read input from the console
Sort the array
Print the array


These steps are distinct features, their implementations are independent from each other.
It would be better if they were in separate functions.
That will make the responsibilities of each function clear,
and easy to test and verify the correct behavior.

Declare and initialize variables right before you need them

Instead of this:


int size, temp = 0;
System.out.println("Enter the size of the array");
Scanner sc = new Scanner(System.in);
size = sc.nextInt();



You could declare and initialize size where needed:

System.out.println("Enter the size of the array");
Scanner sc = new Scanner(System.in);
int size = sc.nextInt();


Notice that I completely dropped temp.
It's not needed here.
You can declare it later when needed.

Unnecessary throws

The main method declares to throw IOException but it's unnecessary.

Style

Although this is a valid way to declare an array in Java, it's unusual:


int arr[] = new int[size];



This is the recommended writing style:

int[] arr = new int[size];


The reasoning is that [] is part of the type.
In int arr[] the type and the variable name are mixed,
in int[] arr the type is cleanly at the left,
and the variable name is cleanly at the right.

The same goes for String args[] in the arguments of main.