Java - Write code to remove a number of characters from the beginning and the end of a string

Requirements

Write code to remove a number of characters from the beginning and the end of a string

Demo

//package com.book2s;

public class Main {
    public static void main(String[] argv) {
        String s = "book2s.com";
        int numStart = 42;
        int numEnd = 42;
        System.out.println(strip(s, numStart, numEnd));
    }// ww w .j a  v a 2 s  . com

    /**
     * removes a number of characters from the beginning and the end of a string
     */
    public static String strip(String s, int numStart, int numEnd) {
        if (s == null) {
            return s;
        }

        return s.substring(numStart, s.length() - numEnd);
    }
}