Java Array Length Get lengthCheck(final byte[] buffer, final byte length)

Here you can find the source of lengthCheck(final byte[] buffer, final byte length)

Description

length Check

License

Open Source License

Declaration

private static void lengthCheck(final byte[] buffer, final byte length) 

Method Source Code

//package com.java2s;
/**/*w  ww  . ja  va 2  s  . co  m*/
 * jModuleConnect is an framework for communication and file management on modem 
 * modules.
 * 
 * This project was inspired by the project TC65SH 
 * by Christoph Vilsmeier: <http://www.vilsmeier-consulting.de/tc65sh.html>
 * 
 * Copyright (C) 2015 sitec systems GmbH <http://www.sitec-systems.de>
 * 
 * This file is part of jModuleConnect.
 * 
 * jModuleConnect is free software: you can redistribute it and/or modify it 
 * under the terms of the GNU Lesser General Public License as published by the 
 * Free Software Foundation, either version 3 of the License, or (at your option) 
 * any later version.
 * 
 * jModuleConnect is distributed in the hope that it will be useful, but WITHOUT 
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 
 * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more 
 * details.
 * 
 * You should have received a copy of the GNU Lesser General Public License
 * along with jModuleConnect. If not, see <http://www.gnu.org/licenses/>.
 */

public class Main {
    private static void lengthCheck(final byte[] buffer, final byte length) {
        if (buffer.length != length) {
            throw new IllegalArgumentException("buffer length must be " + length + " bytes");
        }
    }
}

Related

  1. length(String[] arr)
  2. length(T[] a)
  3. length3(float[] a)
  4. lengthArray(Object[][] arr)
  5. lengthCheck(double[] src, double[] dest)
  6. lengthNeeded(byte[] b)
  7. lengthOf(T[] array)
  8. lengthOfShortestIn(String[] strings)
  9. lengthSQ(double[] vector)