double round robin tournament

I am developing a sport torunament in java based on round robin scheduling algorithm. For n teams I want to generate 2(n-1)rounds with n/2 matches. That is that every team must play a match in a round, and every 2 teams meet twice, once away and once home. I managed to implement the algoritm except for the home/away part. I am able to generate the rounds, but can not "swap" the teams in the second half of rounds so they play both away and home.

Here is what I have so far:

import java.util.Arrays;
import java.util.Scanner;

public class sports {

public static void main(String[] args) {

//obtain the number of teams from user input
Scanner input = new Scanner(System.in);
System.out.print("How many teams should the fixture table have?");