code: function onescomplement(bin){
    var len = bin.length;
    var onebin = new Array(len);
    for (var i=0; i<len; i++){onebin[i] = !bin[i];}
    return onebin;
  }
docs: Computes the one's complement of the binary number