Package org.apache.commons.math3.exception

# Class DimensionMismatchException

java.lang.Object
java.lang.Throwable
java.lang.Exception
java.lang.RuntimeException
java.lang.IllegalArgumentException
org.apache.commons.math3.exception.MathIllegalArgumentException
org.apache.commons.math3.exception.MathIllegalNumberException
org.apache.commons.math3.exception.DimensionMismatchException

All Implemented Interfaces:
  `Serializable`, `ExceptionContextProvider`

Direct Known Subclasses:
  `NonSquareMatrixException`, `NonSquareOperatorException`

public class DimensionMismatchException extends MathIllegalNumberException
Exception to be thrown when two dimensions differ.

Since:
  2.2
See Also:
  - Serialized Form

## Field Summary

### Fields inherited from class org.apache.commons.math3.exception.MathIllegalNumberException

`INTEGER_ZERO`

## Constructor Summary

Constructors
Constructor
Description
`DimensionMismatchException(int wrong, int expected)`
Construct an exception from the mismatched dimensions.
`DimensionMismatchException(Localizable specific, int wrong, int expected)`
Construct an exception from the mismatched dimensions.

## Method Summary

Modifier and Type
Method
Description
`int`
`getDimension()`

### Methods inherited from class org.apache.commons.math3.exception.MathIllegalNumberException

`getArgument`

### Methods inherited from class org.apache.commons.math3.exception.MathIllegalArgumentException

`getContext, getLocalizedMessage, getMessage`

### Methods inherited from class java.lang.Throwable

`addSuppressed, fillInStackTrace, getCause, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

## Constructor Details

### DimensionMismatchException

public DimensionMismatchException(Localizable specific, int wrong, int expected)
Construct an exception from the mismatched dimensions.

Parameters:
  `specific` - Specific context information pattern.
  `wrong` - Wrong dimension.
  `expected` - Expected dimension.

### DimensionMismatchException

public DimensionMismatchException(int wrong, int expected)
Construct an exception from the mismatched dimensions.

Parameters:
  `wrong` - Wrong dimension.
  `expected` - Expected dimension.

## Method Details

### getDimension

public int getDimension()

Returns:
  the expected dimension.