code: function binten(bin){
    var len = bin.length;
    var result = new Array(len + 4);
    result[len + 3] = false;
    result[len + 2] = bin[len - 1];
    result[len + 1] = bin[len - 2];
    var cnum = 0;
    var c = false
    for(var i=len - 1; i>=2; i--){
      var a = bin[i];
      var b = bin[i-2];
      result[i + 1] = a ^ b ^ c;
  //    c = (a & b) | (a & c) | (b & c);
      cnum = a + b + c;
      c = (cnum>>1) ? true : false;
    }
    result[2] = bin[1] ^ c;
    c = bin[1] & c;
    result[1] = bin[0] ^ c;
    c = bin[0] & c;
    if(c){
      result[0] = true;
      return result;
    }else{
      return result.slice(1);
    }
  }
docs: Multiplication of a binary array with 10 (Ten)