Java Array Shift shiftOnRow(double[][] d, int q)

Here you can find the source of shiftOnRow(double[][] d, int q)

Description

shift On Row

License

Open Source License

Declaration

public static double[][] shiftOnRow(double[][] d, int q) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

public class Main {
    public static double[][] shiftOnRow(double[][] d, int q) {
        double[][] ret = new double[d.length][d[0].length];
        if (q >= 0) {
            for (int i = 0; i < d.length; i++) {
                for (int j = q; j < d[0].length; j++) {
                    ret[i][j] = d[i][j - q];
                }/*from w w w . j a va  2 s .  c  om*/
            }
        } else {
            for (int i = 0; i < d.length; i++) {
                for (int j = 0; j < d[0].length + q; j++) {
                    ret[i][j] = d[i][j - q];
                }
            }
        }
        return ret;
    }
}

Related

  1. shiftLeftI(long[] v, int off)
  2. ShiftLeftOne(int[] arr)
  3. shiftNibbles(byte[] bytes)
  4. shiftOff(T[] a)
  5. shiftOffsets(int[] offsets, int changeOffset, int oldLength, int newLength)
  6. shiftRight(byte[] block)
  7. shiftRight(byte[] x)
  8. shiftRight(int[] result, int[] vec, int shift)
  9. shiftRight(int[] x)