Java Abs abs(int val)

Here you can find the source of abs(int val)

Description

abs

License

BSD License

Declaration

public static final int abs(int val) 

Method Source Code

//package com.java2s;
/**//from www .j a v a2 s  .c  o  m
 * This class is part of JCodec ( www.jcodec.org ) This software is distributed
 * under FreeBSD License
 * 
 * @author The JCodec project
 * 
 */

public class Main {
    public static final int abs(int val) {
        int sign = (val >> 31);
        return (val ^ sign) - sign;
    }
}

Related

  1. abs(float[] values)
  2. abs(int i)
  3. abs(int n)
  4. abs(int number)
  5. abs(int pos, double[] array)
  6. abs(int val)
  7. abs(int value)
  8. abs(int x)
  9. abs(long index)