Advertisement
Guest User

Untitled

a guest
May 28th, 2015
203
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.49 KB | None | 0 0
  1. if((int)t1 == 0){
  2.                         if((int)t2 == 0){
  3.                             // both zero
  4.                             return 0;
  5.                         }
  6.                         // only the first val is zero
  7.                         return 1;
  8.                     }else if((int)t2 == 0){
  9.                         // only the second val is zero
  10.                         return -1;
  11.                     }else{
  12.                         // no val is zero -> compare them
  13.                         return (int) (t1
  14.                                 - t2);
  15.                     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement