Swaps rows in Matrix - Java java.lang

Java examples for java.lang:Math Matrix

Description

Swaps rows in Matrix

Demo Code


//package com.java2s;

public class Main {
    /**// w w w.j  a  v  a2 s.  co  m
     * Swaps rows <code>ra</code> and <code>rb</code>.
     */
    public static void rowSwap(int[][] matrix, int ra, int rb) {
        int[] temp = matrix[ra];
        matrix[ra] = matrix[rb];
        matrix[rb] = temp;
    }
}

Related Tutorials