Hirdetés
- VR topik
- Kormányok / autós szimulátorok topikja
- Milyen videókártyát?
- NVIDIA GeForce RTX 5070 / 5070 Ti (GB205 / 203)
- Gaming notebook topik
- Milyen notebookot vegyek?
- Házimozi belépő szinten
- Androidos tablet topic
- Az Intel korábbi vezére szerint a kvantumforradalom gyorsan elsöpri a GPU-kat
- Hogy is néznek ki a gépeink?
Új hozzászólás Aktív témák
-
disy68
aktív tag
válasz
#74220800
#9284
üzenetére
Java 8 alatt van lehetőség metódus referenciát átadni. Akár az alábbihoz hasonlóan is elindulhatsz:
public class MethodRuntimeChecker {
public static void main(String[] args) {
QuickSorter sorter = new QuickSorter();
int[] array = getNumbers(10_000);
System.out.println(mesureRunTimeNano(sorter::sort, array) + " ns");
System.out.println(mesureRunTimeMilli(sorter::sort, array) + " ms");
}
public static long mesureRunTimeNano(Function<int[], int[]> intSorter, int[] toBeSorted) {
long start = System.nanoTime();
intSorter.apply(toBeSorted);
return System.nanoTime() - start;
}
public static long mesureRunTimeMilli(Function<int[], int[]> intSorter, int[] toBeSorted) {
long start = System.currentTimeMillis();
intSorter.apply(toBeSorted);
return System.currentTimeMillis() - start;
}
private static int[] getNumbers(int count) {
int[] numbers = new int[count];
Random random = new Random();
for (int i = 0; i < count; i++) {
numbers[i] = random.nextInt(count);
}
return numbers;
}
}
Új hozzászólás Aktív témák
A topicot kiemeltem. Valaki nem akar egy nyitó hsz-t írni?:))
- VR topik
- Karácsonyi telefonajánló 2025
- Kormányok / autós szimulátorok topikja
- Villanyszerelés
- Milyen videókártyát?
- Hardcore café
- Sapphi: StremHU | Source – Self-hostolható Stremio addon magyar trackerekhez
- S.T.A.L.K.E.R. 2: Heart of Chornobyl
- NVIDIA GeForce RTX 5070 / 5070 Ti (GB205 / 203)
- Szemüveges topik
- További aktív témák...
- ÚJ Asus V16 V3607VM - 16" WUXGA 144Hz - Core 5 210H - 16GB - 1TB - Win11 - RTX 5050 - 3 év garancia
- Samsung Galaxy A16 / 4/128GB / Kártyafüggetlen / 12Hó Garancia
- BESZÁMÍTÁS! MSI ThinA15 B7VF-449XHU Gamer notebook - R7 7735HS 16GB DDR5 1TB SSD nVidia RTX 4060 8GB
- Telefon felvásárlás!! Honor 400 Lite, Honor 400, Honor 400 Pro
- Bomba ár! Asus Vivobook X411UA - i3-7GEN I 8GB I 128SSD I HDMI I 14" HD I Cam I W11 I Garancia!
Állásajánlatok
Cég: ATW Internet Kft.
Város: Budapest
Cég: BroadBit Hungary Kft.
Város: Budakeszi


