code: function bintohexoutput(bin){
    var len = bin.length;
    var hexoutput = String();
    for(var i=0; i<len; i+=4){
      if((i > 0) && !(i%8)){hexoutput = " " + hexoutput;}
      var value = 0;
      if(bin[len - 1 - i - 0]){value+=1;}
      if(bin[len - 1 - i - 1]){value+=2;}
      if(bin[len - 1 - i - 2]){value+=4;}
      if(bin[len - 1 - i - 3]){value+=8;}
      switch(value){
        case 0:  hexoutput = "0" + hexoutput; break;
        case 1:  hexoutput = "1" + hexoutput; break;
        case 2:  hexoutput = "2" + hexoutput; break;
        case 3:  hexoutput = "3" + hexoutput; break;
        case 4:  hexoutput = "4" + hexoutput; break;
        case 5:  hexoutput = "5" + hexoutput; break;
        case 6:  hexoutput = "6" + hexoutput; break;
        case 7:  hexoutput = "7" + hexoutput; break;
        case 8:  hexoutput = "8" + hexoutput; break;
        case 9:  hexoutput = "9" + hexoutput; break;
        case 10: hexoutput = "a" + hexoutput; break;
        case 11: hexoutput = "b" + hexoutput; break;
        case 12: hexoutput = "c" + hexoutput; break;
        case 13: hexoutput = "d" + hexoutput; break;
        case 14: hexoutput = "e" + hexoutput; break;
        case 15: hexoutput = "f" + hexoutput; break;
        default: break;
      }
    }
    // todo: make faster
    return hexoutput;
  }
docs: Formats the given binary array to a hexadecimal output string