d="$System.in".split()*.padLeft(3) for(n=(d-=d[c=s=0]).size;--n;)n.times{i->d[i]>d[j=i+1]&&[++s,d[i,j]=d[j,i]] printf'compare =%3d swap =%3d data:%s\n',++c,s,d.sum()}
Note that non-ascii characters in the above source code will be escaped (such as \x9f).