Number of prime numbers in a given range I've written a method that should return the numbers of prime numbers in a given range:

public static int numberOfPrim(int up){                 // Returns amount of primnumbers from 0 to up
    if(up&lt;=0){
        return 0;
    }
    int primAmount = 0;
    for(int i = 1; i&lt;=up ; i++){
        if(checkIfPrim(i) == true){
           primAmount++;
        }
    }
    return primAmount;
}

public static boolean checkIfPrim(int number){         // If number is prim -&gt; return true
    if (number &lt; 2){
        return false;
    }
    boolean prim = true;
    if(number == 2){
        return prim;
    }
    boolean[] con = new boolean[number];
    for(int i = 2; i &lt; number; i++){
        if(number %i == 0) {
            con[i] = true;
        }
    }
    for(int j = 0; j &lt; number; j++){
        if(con[j] == true){
            prim = false;
        }
    }
    return prim;
}


The code is working like I want it to. For example, numberOfPrim(10) should return 4 (2, 3, 5, 7). I'm just asking if there are any locations where I can improve my code, like shorten it or if there are any other possibilities to write such a method.
What is the purpose of shortening the term "Prime(s)" to Prim in your method names? IMO numberOfPrimes and checkIfPrime are more readable. The same is true for primAmount etc.
if(checkIfPrim(i) == true) can simply be if (checkIfPrim(i))
Your spacing is inconsistent. Generally, it is recommended to leave a space between a control structure (for, if, while etc.) and its following open paren, which you adhere to exactly once in checkIfPrim, but not elsewhere. The same applies to operators: Write up &lt;= 0 instead of up&lt;=0.
Your checkIfPrim method is grossly overcomplicated. First of all, you check every number up to number for divisibility, while it should be obvious that there can be no divisor greater than number / 2. Still, if you think about the problem, you will soon arrive at another conclusion, which is that you only need to check numbers up to sqrt(number), because you can write a * b = number (with a and b being positive integers), which is to say that a and b are divisors of number. Now, letting sqrt(number) = c * c, and by thinking about how multiplication behaves, we can conclude that either a or b must always be lesser or equal to  while the other must be greater or equal to c, because when either a or b is smaller than c the total product would shrink unless the other one grows to counteract this fact.
The next problem is your use of a boolean array, which is completely redundant. You do not need to store the result of the division test for each number separately, but you only have to keep track of whether you have found a divisor for number (=> number is not prime) or not (=> number is prime). All in all, I would rewrite the method to something like this:

public static boolean checkIfPrime(int number) {
    if (number &lt; 2) {
        return false;
    }

    if (number == 2) {
        return true;
    }

    int root = (int) Math.sqrt(number);
    for (int i = 2; i &lt;= root; i++) {
        if (number % i == 0) {
            return false;
        }
    }

    return true;
}





Although this code should be reasonably efficient for relatively small numbers, there are faster algorithms to solve this problem. However, most of these are not as easy to implement, and if you are not planning on doing this for very large integers, then you should be fine with the changes I suggested. If you are still interested in improving effiency, I point you to the Wikipedia article about the prime-counting function for a start.