Java Zigzag Encode zigzagEncode(int input)

Here you can find the source of zigzagEncode(int input)

Description

zigzag Encode

License

Open Source License

Declaration

public static int zigzagEncode(int input) 

Method Source Code

//package com.java2s;

public class Main {
    public static int zigzagEncode(int input) {
        return (input << 1) ^ (input >> 31);
    }/*from ww w .  ja v a2 s  . c  om*/

    public static long zigzagEncode(long input) {
        return (input << 1) ^ (input >> 63);
    }
}

Related

  1. zigzagEncode(byte[] data)
  2. zigZagEncode(int i)
  3. zigzagEncode(int input)
  4. zigZagEncode(long l)
  5. zigZagEncode(long n)
  6. zigzagEncode(long val)
  7. zigZagSort(int[] array)