Since you said without any libraries you could reimplement the Collections.shuffle(...) method for arrays.
int [] randoms = new int[5];
// creating an array containing the numbers 1-10
int [] shuffleArray = new int[10];
for (int i = 1; i <= 10; i++) {
shuffleArray[i-1] = i;
}
// shuffling that array
Random random = new Random();
for (int i = 0; i < 10; i++) {
int j = random.nextInt(10);
int tmp = shuffleArray[i];
shuffleArray[i] = shuffleArray[j];
shuffleArray[j] = tmp;
}
// assigning the first 5 values to the random array
for (int i = 0; i < randoms.length; i++) {
randoms[i] = shuffleArray[i];
}
Although i have to remark that Random
needs an import too (needs a library too)