Example usage for java.lang Byte compare

List of usage examples for java.lang Byte compare

Introduction

In this page you can find the example usage for java.lang Byte compare.

Prototype

public static int compare(byte x, byte y) 

Source Link

Document

Compares two byte values numerically.

Usage

From source file:Main.java

public static void main(String[] args) {
    byte b1 = 1;
    byte b2 = 2;
    System.out.println(Byte.compare(b1, b2));
}

From source file:net.mintern.primitive.pair.BytePair.java

/**
 * Compares the pair based on the left element followed by the right element.
 *
 * @param other  the other pair, not null
 * @return negative if this is less, zero if equal, positive if greater
 */// w  w  w . j a v a2  s.co  m
@Override
public int compareTo(BytePair other) {
    int cmp = Byte.compare(getLeft(), other.getLeft());
    return cmp != 0 ? cmp : Byte.compare(getRight(), other.getRight());
}

From source file:net.mintern.primitive.pair.ByteIntPair.java

/**
 * Compares the pair based on the left element followed by the right element.
 *
 * @param other  the other pair, not null
 * @return negative if this is less, zero if equal, positive if greater
 *//*from  www . j av a2  s.  co m*/
@Override
public int compareTo(ByteIntPair other) {
    int cmp = Byte.compare(getLeft(), other.getLeft());
    return cmp != 0 ? cmp : Integer.compare(getRight(), other.getRight());
}

From source file:net.mintern.primitive.pair.ByteLongPair.java

/**
 * Compares the pair based on the left element followed by the right element.
 *
 * @param other  the other pair, not null
 * @return negative if this is less, zero if equal, positive if greater
 *///from  w  ww  . j  av  a 2 s  .c  o m
@Override
public int compareTo(ByteLongPair other) {
    int cmp = Byte.compare(getLeft(), other.getLeft());
    return cmp != 0 ? cmp : Long.compare(getRight(), other.getRight());
}

From source file:net.mintern.primitive.pair.ByteBooleanPair.java

/**
 * Compares the pair based on the left element followed by the right element.
 *
 * @param other  the other pair, not null
 * @return negative if this is less, zero if equal, positive if greater
 *///from w w  w  .  j av a2  s . c om
@Override
public int compareTo(ByteBooleanPair other) {
    int cmp = Byte.compare(getLeft(), other.getLeft());
    return cmp != 0 ? cmp : Boolean.compare(getRight(), other.getRight());
}

From source file:net.mintern.primitive.pair.IntBytePair.java

/**
 * Compares the pair based on the left element followed by the right element.
 *
 * @param other  the other pair, not null
 * @return negative if this is less, zero if equal, positive if greater
 *///  w w  w  .ja  va2  s.  com
@Override
public int compareTo(IntBytePair other) {
    int cmp = Integer.compare(getLeft(), other.getLeft());
    return cmp != 0 ? cmp : Byte.compare(getRight(), other.getRight());
}

From source file:net.mintern.primitive.pair.LongBytePair.java

/**
 * Compares the pair based on the left element followed by the right element.
 *
 * @param other  the other pair, not null
 * @return negative if this is less, zero if equal, positive if greater
 *//*w w  w.ja  v a2s.co  m*/
@Override
public int compareTo(LongBytePair other) {
    int cmp = Long.compare(getLeft(), other.getLeft());
    return cmp != 0 ? cmp : Byte.compare(getRight(), other.getRight());
}

From source file:net.mintern.primitive.pair.FloatBytePair.java

/**
 * Compares the pair based on the left element followed by the right element.
 *
 * @param other  the other pair, not null
 * @return negative if this is less, zero if equal, positive if greater
 *//*from   ww  w  . j a  va  2 s  .c  o  m*/
@Override
public int compareTo(FloatBytePair other) {
    int cmp = Float.compare(getLeft(), other.getLeft());
    return cmp != 0 ? cmp : Byte.compare(getRight(), other.getRight());
}

From source file:net.mintern.primitive.pair.CharBytePair.java

/**
 * Compares the pair based on the left element followed by the right element.
 *
 * @param other  the other pair, not null
 * @return negative if this is less, zero if equal, positive if greater
 *//*from w  w  w  .  j a  va 2s .com*/
@Override
public int compareTo(CharBytePair other) {
    int cmp = Character.compare(getLeft(), other.getLeft());
    return cmp != 0 ? cmp : Byte.compare(getRight(), other.getRight());
}

From source file:net.mintern.primitive.pair.DoubleBytePair.java

/**
 * Compares the pair based on the left element followed by the right element.
 *
 * @param other  the other pair, not null
 * @return negative if this is less, zero if equal, positive if greater
 *///from   www .j a  va 2  s.  c  o  m
@Override
public int compareTo(DoubleBytePair other) {
    int cmp = Double.compare(getLeft(), other.getLeft());
    return cmp != 0 ? cmp : Byte.compare(getRight(), other.getRight());
}