Sum of Non Boundary Elements

Given a 4×4 matrix the task is to sum non-boundary elements of the matrix.

Example: Consider the 4×4 matrix

3146
8192
2735
4216

Sum of non-boundary elements: 20

Java
import java.util.*;
class SumNonBoundaryElements
{
    public static void main(String args[])
    {
        int sum=0;
        Scanner sc=new Scanner(System.in);
        int ar[][]=new int[4][4];
        System.out.println("Enter matrix elements:-");
        for(int i=0;i<4;i++)
        {
            for(int j=0;j<4;j++)
            {
                ar[i][j]=sc.nextInt();
            }
        }
        for(int i=1;i<3;i++)
        {
            for(int j=1;j<3;j++)
            {
                sum=sum+ar[i][j];
            }
        }
        System.out.println("Sum of non-boundary elements: "+sum);
    }
}
Java