Deep copy int Matrix - Java Data Structure

Java examples for Data Structure:Matrix

Description

Deep copy int Matrix

Demo Code


//package com.java2s;

public class Main {

    public static int[][] deepCopyIntMatrix(int[][] input) {
        if (input == null)
            return null;
        int[][] result = new int[input.length][];
        for (int r = 0; r < input.length; r++) {
            result[r] = input[r].clone();
        }/*from  w w  w. ja va  2s .  c o m*/
        return result;
    }
}

Related Tutorials