Java - Write code to check if a string is representing a Byte value

Requirements

Write code to check if a string is representing a Byte value

Demo

//package com.book2s;

public class Main {
    public static void main(String[] argv) {
        String src = "book2s.com";
        System.out.println(isByte(src));
    }//  www .  jav a  2 s .com

    public static boolean isByte(String src) {
        if (src == null || src.equals(""))
            return false;
        try {
            Byte.parseByte(src);
            return true;
        } catch (Exception e) {
            return false;
        }
    }
}