Programme pour calculer et renvoyer la somme de distance entre les nombres adjacents dans un éventail de Java entier positif

def findTotalSum(n,numbers,pos):
    total = 0
    for i in range(pos-1,n-1):
        total+= abs(numbers[i]-numbers[i+1])
    return total
n = int(input())
numbers = list(map(int, input().split()))
pos = int(input())
print(findTotalSum(n,numbers,pos))
Uptight Unicorn