Before you do anything check for an empty List or a 0 divisor.
if(divisor==0||array1.isEmpty()){
return false;
}
Then you can check the list.
for(Integer i: array1){
if(i%divisor!=0){
return false;
}
}
Finally.
return true;
More Related Contents:
- How to get the separate digits of an int number?
- What’s the syntax for mod in java
- How does java do modulus calculations with negative numbers?
- Best way to make Java’s modulus behave like it should with negative numbers?
- How do I use modulus for float/double?
- my program run 100% from compiler put not run 100% from dist
- Counting the occurrence of a special character, numbers and letters on a user-specified string
- Variable might not have been initialized error
- How to open a new tab using Selenium WebDriver in Java?
- The JPA hashCode() / equals() dilemma
- @Autowired bean is null when referenced in the constructor of another bean
- recyclerview horizontal scrolling to left
- How do I turn a String into a InputStreamReader in java?
- Turning Sonar off for certain code
- How do I create a Linked List Data Structure in Java? [closed]
- How do I extract a tar file in Java?
- Java LinkedHashMap get first or last entry
- How to Daemonize a Java Program?
- Adding ChartPanel to JTabbedPane using JPanel
- How to format LocalDate to string?
- How to convert .pfx file to keystore with private key?
- Netbeans console does not display Bangla unicode characters
- Is there a way to get the value of a HashMap randomly in Java?
- Does Arrays.copyOf produce a shallow or a deep copy?
- Using gson to deserialize specific JSON field of an object
- logging with AOP in spring?
- Using a private variable in a inherited class – Java
- What is optimum thread pool size for simple program running cpu based tasks in Java
- java : Understanding Arrays.asList(T…array) method for primitive types
- create hot keys for JButton in java using swing