Java?? ?? ??
1. java.lang ??? Math ????? random() ???? ???? ??? ?????.
??? ??? java? ? ??? ????. ?? ??? MyRandom???. write in this class ?? ??:
public class MyRandom { public static void main(String[] args) { int radom = (int)(Math.random()*10); System.out.println(radom); } }
Math.random() //0? 1 ??? ??? ???? ?????.
0?? 9 ??? ??? ??? ?? ?????: (int)(Math.random()*10);
1?? 10 ??? ??? ??? ?? ?????: (int)(Math.random( )*10 + 1);
??: 0~n ??? ??? ????? ??? ?? ???? ???: Math.random()*n;
??? ??? ??? ?? ?? ????:
public static int buildRandom(int length) { int num = 1; double random = Math.random(); if (random < 0.1) { random = random + 0.1; } for (int i = 0; i < length; i++) { num = num * 10; } return (int) ((random * num)); }
2. ???? Random ???? ?????. java.util.? ???? ????? ?? ?? ???? ???? ??? ??? ???? ? ?????. ?? ?? ? ???? nextInt() ???? ?????. Random ???? ???? ?? ??? ???? java.util? ?????. .Random ; ??? ??? ????.
import java.util.Random; public class MyRandom { public static void main(String[] args) { Random rand = new Random(); int rInt = rand.nextInt(10); System.out.println(rInt); } }Random rand = new Random()? ??? ?? ???? ???? ????. rand.nextInt(int n)? 0(??)?? ?????. ) ? ??? ? n(??). Java??? ??? ?? ?? ????? ??? ?? ?? ??? ?????.?? ?? 20 ??? 6?? ?? ?? ?? ??? ?????.
public class MyRandom { public static void main(String[] args) { int n = 20; Random rand = new Random(); boolean[] bool = new boolean[n]; int randInt = 0; for(int i = 0; i < 6 ; i++) { do { randInt = rand.nextInt(n); }while(bool[randInt]); bool[randInt] = true; System.out.println(randInt); } } }?? ?? ??? ???? ??? ??? ?????? ??? ?????. . ?? ? ??? ??? ??? ?? ?? ???? ??? ??? ?? ???. ??? ??? ???? ?? do...while ??? ???? ?? ???? ??? ?????. ???? ?? ?????. ?: ??? 50? int ??? ??? ???? 0-50 ??? ??? ???? ???? ??? ? ????. ??? ??? ????.
public class MyRandom { public static void main(String[] args) { int[] intRandom = new int[50]; List mylist = new ArrayList(); //生成數(shù)據(jù)集,用來(lái)保存隨即生成數(shù),并用于判斷 Random rd = new Random(); while(mylist.size() < 50) { int num = rd.nextInt(51); if(!mylist.contains(num)) { mylist.add(num); //往集合里面添加數(shù)據(jù)。 } } for(int i = 0;i <mylist.size();i++) { intRandom[i] = (Integer)(mylist.get(i)); } } } /** * 隨機(jī)產(chǎn)生指定的范圍不重復(fù)的集合 * @param size * @return */ public static Set<Integer> generateRandomArray(int size){ Set<Integer> set = new LinkedHashSet<Integer>(); //集合是沒(méi)有重復(fù)的值,LinkedHashSet是有順序不重復(fù)集合,HashSet則為無(wú)順序不重復(fù)集合 Integer num = size; Integer range = size; Random ran = new Random(); while(set.size() < num){ Integer tmp = ran.nextInt(range); //0-51之間隨機(jī)選一個(gè)數(shù) set.add(tmp);//直接加入,當(dāng)有重復(fù)值時(shí),不會(huì)往里加入,直到set的長(zhǎng)度為52才結(jié)束 } return set; }? ?? Java ??? ?? ???
java ?? ???? ??? ??????.
? ??? Java?? ???? ?? ??? ???? ??? ?? ?????. ??? ??? PHP ??? ????? ?? ?? ??? ?????!

? AI ??

Undress AI Tool
??? ???? ??

Undresser.AI Undress
???? ?? ??? ??? ?? AI ?? ?

AI Clothes Remover
???? ?? ???? ??? AI ?????.

Clothoff.io
AI ? ???

Video Face Swap
??? ??? AI ?? ?? ??? ???? ?? ???? ??? ?? ????!

?? ??

??? ??

???++7.3.1
???? ?? ?? ?? ???

SublimeText3 ??? ??
??? ??, ???? ?? ????.

???? 13.0.1 ???
??? PHP ?? ?? ??

???? CS6
??? ? ?? ??

SublimeText3 Mac ??
? ??? ?? ?? ?????(SublimeText3)

JDBC ????? ???? ????? ?? ?? ?? ??? ?? ?? ??? ?? ? ?? ??? ?? ?? ?? ??? ???????. 1. ????? ????? Conn.SetAutoCommit (False)?? ??????. 2. ??? ? ????? ?? ?? SQL ??? ?????. 3. ?? ??? ??? ?? Conn.commit ()?? ???? ??? ???? ???? ?? ??? ???? Conn.Rollback ()?? ??????. ???, ? ??? ???? ????, ??? ???? ????, ?? ??? ??? ?? ??? ??? ???? ? ???????. ?? ?? ?? ???? ????? ??? ???? ?? ?? ???? ???? ??? ????? ?? ??? ??? ? ?? ???? ?? ????.

thejvmenablesjava? "WriteOnce, Runynywhere"??? ?? excodecodethroughfourmaincomponents : 1. theclassloadersubsystemloads, ??, ? intinitializes.classfilesusingbootsprap, extension, andapplicationclassloaders, ensuringsecureandlazyclasloa

?? ?? ? ?? ???? ???? ?? Java.Time ???? ???? ??????. 2. LocalDate, LocalDateTime ? LocalTime? ?? ?? ??? ??? ?????. 3. () ???? ???? ?? ??? ??? ????. 4. ???/???? ??? ???? ??? ????? ??? ??????. 5. ZonedDateTime ? Zoneid? ???? ???? ??????. 6. DateTimeFormatter? ?? ?? ? ?? ?? ?? ???; 7. ??? ?? ?? ?? ??? ????? ?? ??????. ?? Java? ?? ??? ???? ??? ??? ???? Java.Timeapi ??? ?? ??? ???????.

Pre-FormancetArtUptimeMoryUsage, Quarkusandmicronautleadduetocompile-timeprocessingandgraalvsupport, withquarkusoftenperforminglightbetterine serverless sinarios.2.thyvelopecosyste,

NetworkPortSandfirewallsworkTogetToenableCommunication whileensuringsecurity.1.networkportSarevirtualendpointsnumbered0–65535, Withwell-nownports like80 (http), 443 (https), 22 (ssh) ? 25 (smtp) ?? (specservices

Java 's Garbage Collection (GC)? ???? ???? ???? ??????, ?? ? ??? ??? ? ??? ??? ??? ??? ????. 1.GC? ?? ?? (? : ?? ??, ?? ???, ?? ?? ?)?? ??? ???? ????, ?? ? ??? ??? ???? ?????. 2. ?? ???? ????? ????, ?? ?? ??? ??? ???? ?? ??? ??????. 3. ?? ?? ?? ?? : ??? ?? (Eden, S0, S1)? ?? ????? ?????. ??? ??? ?? ? MajorGC? ???? ? ??? ? ????. Metaspace? ??? ?? ???? ?????. 4. JVM? ??? GC ??? ?????. SerialGC? ??? ?? ????? ?????. ParallelGC? ???? ??????. CMS? ?? ???

GradleisBetTerChoiceFormostNewProjectSduetoitssuperiorflexible, Performance, and ModernToolingsupport.1.Gradle'Sgroovy/kotlindslismoreConcisENDEXPRESSIVETHANMAVEN'SVOSEXML.2.GradleOutsMaveninbuildweedweedweedweedweedweedweedweedweedweedweedweedweedweede

DEFER? ??? ???? ?? ??? ??? ???? ? ?????. ?? ??? ?? ? ? ?? ????, ??? ??? ? ?? ?? (LIFO)? ??? ?????. 1. ?? ??? ??? ? ??? ?????. 2. ?? ??? ?? ??? ??? ????? ?????. 3. ?? ? ?? ?? ??? ? ????. 4. ??? ?????? ??? ??? ???? ?????. 5. ?? ??? ???? ?? ??? ?? ??? ?????. ??? ??? ?? ?? ? ???? ???? ? ????.
