@Override public final int size(){
  return (int)Math.max((tail.get() - head.get()),0);
}

@ Override public final int size ( ) { return ( int ) Math . max ( ( tail . get ( ) - head . get ( ) ) , 0 ) ; }
this implemention is known to be broken if preemption were to occur after reading the tail pointer . code should not depend on size for a correct result .
