boolean (Number value, PsiType type) { final long longValue = value.longValue(); final double doubleValue = value.doubleValue(); if (PsiTypes.byteType().equals(type)) { return longValue >= (long)Byte.MIN_VALUE && longValue <= (long)Byte.MAX_VALUE && doubleValue >= (double)Byte.MIN_VALUE && doubleValue <= (double)Byte.MAX_VALUE; } else if (PsiTypes.charType().equals(type)) { return longValue >= (long)Character.MIN_VALUE && longValue <= (long)Character.MAX_VALUE && doubleValue >= (double)Character.MIN_VALUE && doubleValue <= (double)Character.MAX_VALUE; } else if (PsiTypes.shortType().equals(type)) { return longValue >= (long)Short.MIN_VALUE && longValue <= (long)Short.MAX_VALUE && doubleValue >= (double)Short.MIN_VALUE && doubleValue <= (double)Short.MAX_VALUE; } else if (PsiTypes.intType().equals(type)) { return longValue >= (long)Integer.MIN_VALUE && longValue <= (long)Integer.MAX_VALUE && doubleValue >= (double)Integer.MIN_VALUE && doubleValue <= (double)Integer.MAX_VALUE; } else if (PsiTypes.longType().equals(type)) { return doubleValue >= (double)Long.MIN_VALUE && doubleValue <= (double)Long.MAX_VALUE; } else if (PsiTypes.floatType().equals(type)) { return doubleValue == value.floatValue(); } else if (PsiTypes.doubleType().equals(type)) { return true; } return false; }