Display size calculations problem

Thank you for the answer!

Thank you for the reminder! That is why I substract the size of the square then divide the remaining space by two, in order to get the same space on both sides!
After modifying my code as such:

int fartop=0;
int farleft=0;

void setup(){
  fullScreen();
  background(255);
  fartop=(displayHeight-1000)/2;
  farleft=(displayWidth-1000)/2;
}

void draw(){
  fill(0);
  rect(farleft, fartop, 1000, 1000);
}

It gave me the awaited result! Much thanks for the help!