Java Integer Divide Divide(Object in, int val)

Here you can find the source of Divide(Object in, int val)

Description

Divide

License

Open Source License

Declaration

public static final void Divide(Object in, int val) 

Method Source Code

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

public class Main {
    public static final void Divide(Object in, int val) {
        if (in == null)
            return;
        if (val == 0)
            return;
        if (in instanceof int[]) {
            int[] inn = (int[]) in;
            for (int i = 0, s = inn.length; i < s; i++)
                inn[i] /= val;
        } else {/*from w  w w .  jav  a  2 s  .  c  o m*/
            for (int i = 0, s = ((Object[]) in).length; i < s; i++)
                Divide(((Object[]) in)[i], val);
        }
    }

    public static final void Divide(int val, Object in) {
        if (in == null)
            return;
        if (val == 0)
            return;
        if (in instanceof int[]) {
            int[] inn = (int[]) in;
            for (int i = 0, s = inn.length; i < s; i++)
                inn[i] = (int) (val / inn[i]);
        } else {
            for (int i = 0, s = ((Object[]) in).length; i < s; i++)
                Divide(((Object[]) in)[i], val);
        }
    }

    public static final void Divide(Object in, Object in2) {
        if (in == null || in2 == null)
            return;
        if (in instanceof int[]) {
            int[] inn = (int[]) in;
            for (int i = 0, s = inn.length; i < s; i++)
                inn[i] /= ((int[]) in2)[i];
        } else {
            for (int i = 0, s = ((Object[]) in).length; i < s; i++)
                Divide(((Object[]) in)[i], ((Object[]) in2)[i]);
        }
    }
}

Related

  1. divide(final String bitmap, final int row)
  2. divide(int numerator, int denominator)
  3. divide(int numerator, int denominator)
  4. divide(int value, int divideBy)
  5. divide(int x, int y)
  6. divideAndCeil(int a, int b)
  7. divideAndCeil(int dividend, int divisor)
  8. divideAndRound(int dividend, int divisor)
  9. divideAndRoundUp(long dividend, int divisor)