how do i write java loop program where the user enters 10 random numbers. the program then collects the prime numbers from that 10 random numbers and adds all the prime numbers and prints the sum of the prime numbers. if the number 13 is entered, the loop stops.

I assume you can write a loop and get input.

sum=0
start loop...
get input n
if n==13 break;
if prime(n) sum += n
end loop...
print sum

now: how to test for a prime value?
A simple example for this can be found at

https://www.programmingsimplified.com/java/source-code/java-program-print-prime-numbers

You will find that google is very useful for turning up java code for almost anything you want to do.

To write a Java program that meets your requirements, you can use a combination of loops and conditions. Here's an example implementation:

```java
import java.util.Scanner;

public class PrimeNumberSum {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);

int sum = 0;
int count = 0;

System.out.println("Enter 10 numbers:");
while (count < 10) {
int number = scanner.nextInt();

// Check if the number is 13
if (number == 13) {
break;
}

// Check if the number is prime
if (isPrime(number)) {
sum += number;
count++;
}
}

System.out.println("Sum of prime numbers: " + sum);
scanner.close();
}

// Method to check if a number is prime
public static boolean isPrime(int number) {
if (number < 2) {
return false;
}
for (int i = 2; i <= Math.sqrt(number); i++) {
if (number % i == 0) {
return false;
}
}
return true;
}
}
```

Explanation:
1. We start by importing the `Scanner` class to read user input.
2. We declare two variables: `sum` to hold the sum of prime numbers, and `count` to keep track of the number of prime numbers entered so far.
3. We prompt the user to enter 10 numbers using `System.out.println("Enter 10 numbers:")`.
4. Inside the `while` loop, we read each number using `scanner.nextInt()` and store it in the `number` variable.
5. We check if the number entered is equal to 13 using `if (number == 13)`. If so, we break out of the loop using `break`.
6. We check if the number is prime by calling the `isPrime` method. If it is prime, we update the `sum` by adding the number, and increment the `count` by 1.
7. After the loop finishes, we print the sum of the prime numbers using `System.out.println("Sum of prime numbers: " + sum)`.
8. Finally, we close the scanner using `scanner.close()` to release system resources.

The method `isPrime` checks whether a given number is prime. It returns `true` if the number is prime and `false` otherwise. The method implements a basic prime number check by iterating from 2 up to the square root of the number, and checking for any divisors. If a divisor is found, the number is not prime.

You can run the program and enter the 10 numbers, one by one. When you enter 13, the loop will stop, and the program will print the sum of the prime numbers entered.