Anyone know of a function in the Java API that returns an integer that can convert neg/pos or pos/neg? I can code it but id rather use a function if one exists.
Code:/* small prog to test formulas formulas --> -/+ (-n == ~n + 1) or ((-n + 1) ~n == n) +/- (n == ~n + 1) or ((n-1) ~n == (-n)) */ class progTest{ public static void main(String[] args){ if(args.length == 1){ int n = Integer.parseInt(args[0]); // n = ~n + 1; can use either n = n - 1; n = ~n; System.out.println(n); }else{ System.out.println(); System.out.println("Usage 1 arguement"); } } }




Reply With Quote