code: public static <T> T[] dropRight(T[] self, int num) {
          if (self.length <= num) {
              return createSimilarArray(self, 0);
          }
          if (num <= 0) {
              T[] ret = createSimilarArray(self, self.length);
              System.arraycopy(self, 0, ret, 0, self.length);
              return ret;
          }
  
          T[] ret = createSimilarArray(self, self.length - num);
          System.arraycopy(self, 0, ret, 0, self.length - num);
          return ret;
      }
docs: Drops the given number of elements from the tail of this array
  if they are available.
  <pre class="groovyTestCase">
  String[] strings = [ 'a', 'b', 'c' ]
  assert strings.dropRight( 0 ) == [ 'a', 'b', 'c' ] as String[]
  assert strings.dropRight( 2 ) == [ 'a' ] as String[]
  assert strings.dropRight( 5 ) == [] as String[]
  </pre>
  
  @param self the original array
  @param num  the number of elements to drop from this array
  @return an array consisting of all elements of this array except the
  last <code>num</code> ones, or else the empty array, if this
  array has less than <code>num</code> elements.
  @since 2.4.0