// Author: *** // Date: *** // Tabs: *** (indicate the separation between tab stops) //============================================================== // These functions work on arrays that represent binary numbers. // Each value in the arrays is either 0 or 1, and the low order // bit is at index 0. For example, if array A contains binary // number 14 (1110 in standard binary notation), then it might be // that // A[0] = 0 // A[1] = 1 // A[2] = 1 // A[3] = 1 // // Say that a binary number is *normalized* if its highest order // bit is 1. (As a special case, 0 is normalized if it is // represented by an array of length 0.) // // All results of these functions are normalized. But the // parameters are not required to be normalized. For example, // if array A holds // A[0] = 0 // A[1] = 1 // A[2] = 1 // A[3] = 1 // A[4] = 0 // A[5] = 0 // then A is a non-normalized representation of 14. //============================================================== public class Arithmetic { //================================================================= // inc(A) returns an array of bits representing A+1. //================================================================= public static byte[] inc(byte[] A) { ... } //================================================================= // sum(A,B) returns an array of bits representing A+B. //================================================================= public static byte[] sum(byte[] A, byte[] B) { ... } //================================================================= // product(A,B) returns an array of bits representing A*B. //================================================================= public static byte[] product(byte[] A, byte[] B) { ... } }