text
stringlengths
14
410k
label
int32
0
9
public String findShortestPath(int id,String source,String target, boolean reverse_cost ) { String rTable = "road_profile_"+id; StringBuffer sb = new StringBuffer(); JSONObject jobj = new JSONObject(); JSONObject jstat = new JSONObject(); JSONArray jfeats = new JSONArray(); int sCode ...
4
public boolean isAllCall() { for(Player player : playerList) { if((player.getState().equals(Player.States.WAIT)) || (player.getActionChip() != state.getBetChip() && !player.getState().equals(Player.States.FOLD) && !player.getState().equals(Player.States.ALL_IN) && !player.getState().equals(Player.States.L...
6
@Override public String toString(){ StringWriter aux = new StringWriter(); if (logType == LogType.EXCEPTION | logType == LogType.LEVEL_TIME_MESSAGE){ aux.write(separator); aux.write("[" + level + "] - [" + time + "] --- " + message + "\n"); } else if (logType == LogType.MESSAGE){ aux.write(message);...
4
public static void main(String [] args){ Zegana.initalize(args); if(quit) return; while(genCount != end){ genCount++; simulate(); populate(); } }
2
public String NumbersCalculation(int i) { String s=String.valueOf(i); if (i==10) s="0."; if(checkCalculatorSequence(position -1) && position >0) { if (isANumber(calculatorSequence.get(position - 1))){ if (i==10) s="."; s...
6
public void addScore(boolean onBeat, int bpm) { if (lastScore < 1000 * 60 / bpm / 1.5f) { lastScore = 0; return; } if (onBeat) { int scaleX = Level.getScaledX(level.getXPosition(), x); int width = Level.getScaledX(level.getXPosition(), x + 1) - scaleX; float scale = 1.0f / Constants.TILE_WIDTH * w...
3
public static String readFastaFile(String path) { Scanner sc; try { sc = new Scanner(new File(path)); } catch (Exception e) { sc = new Scanner(""); } String sequence; StringBuilder sb = new StringBuilder(); if (sc.hasNextLine()) { sc.nextLine(); } wh...
3
public static double[] LineEquation (int x1, int y1, int x2, int y2) { double[] arr = new double[7]; // Cramer's Rule to solve system of equation ( 2 x 2 ) if (x1 - x2 != 0) { // y = ax + b arr[0] = (double)(y1 - y2) / (double)(x1 - x2); arr[1] = (double)(x1*y2 - y1*x2) / (dou...
5
public String[] query(String table, int ID, String nameID) { String[] result = null; try { String stm = null; stm = "select * from " + table + " WHERE " + nameID + " = " + ID + " order by " +nameID; con = DriverManager.getConnection(url, user, password); pst = con.prepareStatement(stm); rs = pst.exec...
6
@Override public void keyTyped(KeyEvent e) { //throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. }
0
public void checkLRBounds() { if (getX() > 400) setX(400); if (getX() < -15) setX(-15); if (getY() < 10) setY(10); }
3
public static List<Element> intArrToList(int[] arr) { List<Element> elements = new ArrayList<Element>(); for(int i = 0; i < arr.length; i++){ Element elem = new Element(i, arr[i]); elements.add(elem); } return elements; }
1
final boolean method954(int i, byte i_23_, int i_24_, r var_r) { anInt1630++; r_Sub2 var_r_Sub2 = (r_Sub2) var_r; i_24_ += 1 + ((r_Sub2) var_r_Sub2).anInt10484; if (i_23_ != 88) aClass232ArrayArray1623 = null; i += 1 + ((r_Sub2) var_r_Sub2).anInt10489; int i_25_ = i_24_ * ((Class104) this).anInt1624 + i; in...
7
public Collection<BookingEntity> getBookings() { return bookings; }
0
public static int binarySearch(int[] array, int k) { if(array==null || array.length==0) { return -1; } int start = 0; int end = array.length-1; while(start <= end) { // Attention: This is wrong way // it fails if the sum of low and high // is greater than the maximum positive // int val...
6
public Categorie recalculerDerniereReponse(Reponse ancienneReponse) { if (ancienneReponse.equals(getDerniereReponse())) { derniereReponse = null; for (Sujet sujet : getSujets()) { if (getDerniereReponse() == null || sujet.getDerniereReponse().getTempsMillis() > getDernier...
6
public List<OpenChatRoomDTO> getOpenChatRooms() { List<OpenChatRoomDTO> openchatroomDTOs = new ArrayList<OpenChatRoomDTO>(); List<Openchatroom> openchatrooms = new OpenchatroomDAO().readAll(); int participantsCounter = 0; String currentPerformer = null; for (Openchatroom openchatroom : openchatrooms) { if ...
4
public int length() { return this.map.size(); }
0
public static void paintFocus(Graphics2D g, Shape shape, int pixelSize) { Color focusColor = getFocusRingColor(); Color[] focusArray = new Color[] { new Color(focusColor.getRed(), focusColor.getGreen(), focusColor.getBlue(), 235), new Color(focusColor.getRed(), focusColor...
3
public OpenFileFormat getDefaultOpenFileFormat() { return defaultOpenFileFormat; }
0
public String readAndVerifyMessage() { byte[] message = null; byte[] signature = null; byte[] pubKeyEnc = null; try { // die Datei wird geoeffnet und die Daten gelesen DataInputStream is = new DataInputStream(new FileInputStream( fileName)); ...
6
@Override public void actionPerformed(ActionEvent ae) { if (ae.getSource() == start) { menu.dispose(); Game peli = new Game(setting.getDifficulty()); peli.run(); peli.gameStart(); }else if (ae.getSource() == contin) { Game peli ...
7
public void visitFormalTypeParameter(final String name) { declaration.append(seenFormalParameter ? ", " : "<").append(name); seenFormalParameter = true; seenInterfaceBound = false; }
1
public Object nextValue() throws JSONException { char c = this.nextClean(); String string; switch (c) { case '"': case '\'': return this.nextString(c); case '{': this.back(); return new JSONObject(this); ...
7
private static final void packObjectSpawns() { Logger.log("ObjectSpawns", "Packing object spawns..."); if (!new File("data/map/packedSpawns").mkdir()) throw new RuntimeException( "Couldn't create packedSpawns directory."); try { BufferedReader in = new BufferedReader(new FileReader( "data/map/unpa...
8
public Admin(JPanel adminpanel, JPanel userpanel, JTextField[] userdata, JSlider months, JLabel[] errMess) { this.errMess = errMess; for (int i = 0; i < this.errMess.length; i++) { this.errMess[i].setText(""); } this.adminpanel = adminpanel; this.adminpanel.removeAll...
6
protected RegularExpression getExpression() { return environment.getExpression(); }
0
private void prepareSignatures( final Map<String, ByteClass> byteClasses, final Multimap<String, String> rdepends, final BiMap<String, String> nameMaps, final BiMap<Signature, Signature> signa...
7
public void update() { // 重力で下向きに加速度がかかる vy += Map.GRAVITY; // x方向の当たり判定 // 移動先座標を求める double newX = x + vx; // 移動先座標で衝突するタイルの位置を取得 // x方向だけ考えるのでy座標は変化しないと仮定 Point tile = map.getTileCollision(this, newX, y); if (tile == null) { // 衝突するタ...
6
public String getDatosAdmin(String clave, beansAdministrador admin){ if(clave.trim().equals("nombre")) return admin.getNombre(); if(clave.trim().equals("nick")) return admin.getNick(); if(clave.trim().equals("edad")) return Integer.toString(admin.getEdad()); if(clave.trim().equals("codigo")) return ...
4
public int getNumUnpinnedBuffers() { return replacer.getNumUnpinnedBuffers(); } // end getNumUnpinnedBuffers()
0
public void playerHit(Player player, int id){ player.setHealth(player.getHealth()-20); if(player.getHealth() == 0){ player.setDead(true); String str = ""; List<Integer> shooters = player.getShooters(); shooters.remove(new Integer(id)); for(Integer i : shooters) str += " " + i; netw...
5
public boolean login() { boolean flag = false; String sql = "SELECT * FROM db99527iu6w4ye96.users where username = '"+ username+"'"; System.out.println(sql); Connection conn = (Connection) SQLconnect.getConnection(); try { Statement st = (Statement) conn.createStatement(); // 创建用于执行静态sql语句的Statement对象 R...
3
private void staticHandle(QueueEntry queueEntry, AisVesselTarget vesselTarget) { AisMessage aisMessage = queueEntry.getAisMessage(); // Mappers AisVesselStaticMapper aisVesselStaticMapper = session.getMapper(AisVesselStaticMapper.class); AisClassAStaticMapper aisClassAStaticMapper = session.getMapper(AisClas...
7
private int method317(int arg0, int arg1) { arg1 = 127 - arg1; arg1 = arg1 * (arg0 & 0x7f) / 160; if (arg1 < 2) { arg1 = 2; } else if (arg1 > 126) { arg1 = 126; } return (arg0 & 0xff80) + arg1; }
2
public void addClassesSummary(ClassDoc[] classes, String label, String tableSummary, String[] tableHeader, Content summaryContentTree, int profileValue) { if(classes.length > 0) { Arrays.sort(classes); Content caption = getTableCaption(new RawHtml(label)); ...
8
public void actionPerformed(ActionEvent evt) { String actionCommand = evt.getActionCommand(); if (actionCommand.equals("New Class")) { //Display current status in program status bar canvasPane.setStatus("Click position for new class"); //Set relevant boolean for MouseInterListener buttonPane....
9
private int getDirectionID(Direction d) { switch(d) { case NORTH: return 0; case SOUTH: return 1; case EAST: return 2; case WEST: return 3; case NORTHEAST: return 4; case NORTHWEST: return 5; case SOUTHEAST: return 6; case SOUTHWEST: return 7; } return 0; }
8
public void setExtra(String extra) { this.extra = extra; }
0
public void keyReleased (KeyEvent e) { //sets the motion of the balls int key = e.getKeyCode(); //gets the key pressed if (key == KeyEvent.VK_SPACE) { shot = false; } }
1
public void handleCustomCommand(Client client, String command) { String []pieces = command.split(" "); switch(command.split(" ")[0].toUpperCase()){ case "FILE": if(pieces.length == 3){ if(checkPassword(pieces[1])){ openFile(pieces[2]); } } break; ...
3
public static void InitBitModels(short[] probs) { for (int i = 0; i < probs.length; i++) probs[i] = 1024; }
1
@Override public LinkedList<Individual> crossover(int[] parents, Population pop) { LinkedList<Individual> children = new LinkedList<Individual> (); Random r = new Random(); //choose 2 parents int r1 = r.nextInt(parents.length); int r2 = r.nextInt(parents.length); Individual p1 = pop.people[parents[r1]]...
7
@Override public void paintComponent(Graphics g) { super.paintComponent(g); speelveldUI.drawSpeelveld(g); if(routeUI.getR() != null){ routeUI.drawRoute(g); } }
1
public void run() { synchronized (lock) { for (int i = 0; i < 5; i++) { System.out.println(Thread.currentThread().getName() + " : " + i); if (i == num) { if (isNotifier) { lock.notifyAll(); } else { try { lock.wait(); } catch (InterruptedException e) { e.printStack...
4
public static int checkHeight(TreeNode<Integer> root) { if (root == null) return 0; int left = checkHeight(root.left); int right = checkHeight(root.right); if (left == -1 || right == -1) { return -1; } if (Math.abs(left - right) > 1) return -1; return Math.max(left + 1, right + 1); }
4
@Override public boolean equals(Object o) { if (this == o) return true; if (!(o instanceof Moderator)) return false; Moderator that = (Moderator) o; return factionName.equals(that.factionName) && memberName.equals(that.memberName); }
3
public void perform() { System.out.println("Checking and registering " + usableJabberIdentifiers.size() + " identifiers"); System.out .println("======================================================================"); System.out.println("Checking identifiers:"); System.out .println("----------------...
6
static public ParseException generateParseException() { jj_expentries.clear(); boolean[] la1tokens = new boolean[58]; if (jj_kind >= 0) { la1tokens[jj_kind] = true; jj_kind = -1; } for (int i = 0; i < 30; i++) { if (jj_la1[i] == jj_gen) { for (int j = 0; j < 32; j++) { ...
9
public Object clone() { myDataList cp = new myDataList(); data mydata; for (int i = 0; i < size(); i++) { mydata = (data) get(i); cp.add(new data(mydata.getChar(), mydata.get_probability(), mydata.isFlag())); } return cp; }
1
public Integer insert(MermaBeans merma) throws DAOException { PreparedStatement pst = null; ResultSet generatedKeys = null; try { pst = con.prepareStatement(sql.getString("INSERT_MERMA"), Statement.RETURN_GENERATED_KEYS); //INSERT INTO MERMA (IDMERMA, CANTIDAD) VALUES (?,?) pst.setInt...
7
@Override public String getSelectionChangedActionCommand() { if (mOutlineToProxy != null) { return mOutlineToProxy.getSelectionChangedActionCommand(); } return super.getSelectionChangedActionCommand(); }
1
public void saveToFile(File rulesFile, DependencyRuleSet dontDuplicate) { try { PrintWriter out = new PrintWriter(new FileWriter(rulesFile)); out.println(description); for (DependencyRule rule: getRules()) { if ((dontDuplicate == null || !dontDuplicate.getRul...
6
private boolean isStandardProperty(Class clazz) { return clazz.isPrimitive() || clazz.isAssignableFrom(Byte.class) || clazz.isAssignableFrom(Short.class) || clazz.isAssignableFrom(Integer.class) || clazz.isAssignableFrom(Long.class) || clazz.isAssignab...
9
public ArrayList getAnswers() { ArrayList collectedAnswers = new ArrayList(); for (int i = 0; i < table.getModel().getRowCount(); i++) { collectedAnswers.add(tableModel.getValueAt(i, 0)); } return collectedAnswers; }
1
@Override public String getName() { return "world"; }
0
public void updateStateBasedOnVelocity() { if(vx > 0) { if(vy < 0) { setState(JUMPING_RIGHT); } else { setState(RUNNING_RIGHT); } } else if(vx < 0) { if(vy < 0) { setState(JUMPING_LEFT); ...
4
@Override public void applyTemporaryToCurrent() {cur = tmp;}
0
public void dump(String line) { if (startPos == -1) { pw.print(line); } else { pw.print(line.substring(0, startPos)); dumpRegion(line); pw.print(line.substring(endPos)); } }
1
public static JSONArray jsonMultipleListFilter(String kind, String filterField1, String filterField2, String filterField3, String filterField4, String filterValue1, String filterValue2, String filterValue3, String filterValue4, String sortField, SortDirection sortDirection, final String returnField) { Qu...
4
public List<SimpleMeal> getAllMeals() { Session session = null; Transaction tx = null; SimpleMealDaoImpl dao = getSimpleMealDaoImpl(); ArrayList<SimpleMeal> result = new ArrayList<>(); try { session = HbUtil.getSession(); //TRANSACTION START t...
4
public void drawField() { char codeNumber = '0'; char codeLetter = 'A'; System.out.print(" "); for(int i=0; i < FIELD_SIZE; i++) { System.out.print(" " + codeNumber + " "); codeNumber++; } System.out.print("\n"); for (int i = 0; i < FIELD...
3
@Override public T add(T obj) throws IllegalArgumentException { if (obj == null) { throw new IllegalArgumentException("The object to add must be not null"); } T data = null; if (this.node == null) { this.node = new Node<T>(); data = obj; ...
6
public Configuration[] getInitialConfigurations(String input) { Configuration[] configs = new Configuration[1]; configs[0] = new MealyConfiguration(myAutomaton.getInitialState(), null, input, input, ""); return configs; }
0
private void addBlankBtnActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_addBlankBtnActionPerformed try { question = questionField.getText(); instructions = instructionField.getText(); hlanswer = questionField.getSelectedText(); hlanswer2 = "["...
3
public NZFolderReader(File folderFile) throws IOException { super(); this.folderFile = folderFile; if (folderFile == null) throw new IOException("Cannot take a null parameter as folderFile"); indexFileMap = new HashMap<String, File>(); dataFileMap = new HashMap<String, File>(); for (File temp : folderFil...
8
public void GRASP_Construccion() { int k, j; int b, d, resultado; Random rand = new Random(); boolean flag; auxReq = new int[n]; for (int i = 0; i < n; i++) { auxReq[i] = E[i]; } nReq = n; m = 0; rcl = new int[0]; Res[0] = L; while (nReq > 0) { num_rcl = 0; b = auxReq[0]; d = auxReq...
7
public PGPDataType createPGPDataType() { return new PGPDataType(); }
0
public static void main(String args[]){ //Define Array holding all values of prime or not boolean[] isPrime = new boolean[1001]; for (int i = 2; i <= 1000; i++) { isPrime[i] = true; } //Mark anything that is not prime for (int i = 2; i*i <= 1000; i...
7
public boolean doesElementPrecedeOthers(final Object element, final CycList otherElements) { for (int i = 0; i < this.size(); i++) { if (element.equals(this.get(i))) { return true; } if (otherElements.contains(this.get(i))) { return false; } } return false; }
3
public static void playToLocation(Location loc, FireworkEffect fe) { Object packet = makePacket(loc, fe); for (Entity e : loc.getWorld().getEntities()) { if (e instanceof Player) { if (e.getLocation().distance(loc) <= 60) { ...
3
public int markAll(String toMark, boolean matchCase, boolean wholeWord, boolean regex) { Highlighter h = getHighlighter(); int numMarked = 0; if (toMark!=null && !toMark.equals(markedWord) && h!=null) { if (markAllHighlights!=null) clearMarkAllHighlights(); else markAllHighlights = new ArrayLis...
6
public String toXml() { String result = "<" + factory.getCache().tableName(type) + ">"; Map<String, Object> modelFields = fields(); Set<String> keySet = modelFields.keySet(); String cA = "CreatedAt"; String uA = "UpdatedAt"; for (String k : keySet) if (!k.equals(cA) && !k.equals(uA)) res...
6
protected double[] evaluateGradient(double[] x){ double[] grad = new double[x.length]; for(int i=0; i<m_Classes.length; i++){ // ith bag int nI = m_Data[i][0].length; // numInstances in ith bag double denom=0.0; double[] numrt = new double[x.length]; for(int j=0; j<nI; j++...
8
public JSONArray names() { JSONArray ja = new JSONArray(); Iterator keys = this.keys(); while (keys.hasNext()) { ja.put(keys.next()); } return ja.length() == 0 ? null : ja; }
2
protected int getElementCoverage(Class<? extends Element> elementClass) { if (elementClass == null) throw new IllegalArgumentException("The given arguments are invalid!"); int count = 0; for (Element e : grid.getElementsOnGrid()) if (e.getClass() == elementClass || elementClass.isAssignableFrom(e.getCla...
5
private void popStackToClose(Token.EndTag endTag) { String elName = endTag.name(); Element firstFound = null; Iterator<Element> it = stack.descendingIterator(); while (it.hasNext()) { Element next = it.next(); if (next.nodeName().equals(elName)) { ...
5
public void draw() { if(noChildren()) { GL11.glPushMatrix(); GL11.glTranslated(box.getX() - Theater.get().getScreen().camera.getX(), box.getY() - Theater.get().getScreen().camera.getY(), 0); if(blocked) GL11.glColor3d(1.0, 0, 0); else if(highlight) GL11.glColor3d(0, 1.0, 1.0); else if(flat) ...
5
public Session(Socket s) { soc = s; try { br = new BufferedReader(new InputStreamReader(soc.getInputStream())); pw = new PrintWriter(new BufferedOutputStream(soc.getOutputStream()), true); } catch (IOException e) { JOptionPane.showMessageDialog(null, e, "Error...
2
public void paintComponent(Graphics graphics) { super.paintComponent(graphics); Graphics2D G = (Graphics2D) graphics; drawBackground(G, m_camera); for (Planet p : m_world.getPlanets()) { p.draw(G, m_camera); } for (Ship s : m_world.getShips()) { s.draw(G, m_camera); } if (m_renderThread != ...
4
public Writer writeList(Object o) throws IOException { if (o == null) { writeNull(); return this; } if (o.getClass().isArray()) { return writeList(Arrays.asList(o)); } Collection c = (Collection) o; writeIterator(c.size(), c.iterator())...
2
public static String generateHelp(String pre, Argument[] arguments, String post) { StringBuilder sb = new StringBuilder (); // Append pre if necessary if (pre != null && pre.trim ().length () > 0) { sb.append (pre); sb.append ("\n"); } sb.append ("Arguments:"); sb.append ("\n"); int argsLe...
7
public AbstractModel() { propertyChangeSupport = new PropertyChangeSupport(this); }
0
public void run() { //Guarda el tiempo actual del sistema tiempoActual = System.currentTimeMillis(); //Ciclo principal del Applet. Actualiza y despliega en pantalla la //animacion hasta que el Applet sea cerrado while (true) { if (!pausa && !instrucciones) { ...
4
private Builder(Map<String, Integer> figureQuantityMap) { if (Objects.isNull(figureQuantityMap) || figureQuantityMap.isEmpty()) { throw new IllegalStateException("please provide the figures to put on the board"); } Set<String> possibleFigures = new HashSet<>(); ...
4
public void removeLink(int s, int d){ Node S = null; Node P = null; for(Node N : network) { if(N.id == s) { S = N; } if(N.id == d) { P = N; } } if(S != null && P != nul...
5
public boolean checkDelta() { if (deltaTime >= 1) { deltaTime--; return true; } else { return false; } }
1
private static double grad(int unknown0, double unknown1, double unknown2, double unknown3) { double unknown4 = (unknown0 &= 15) < 8 ? unknown1 : unknown2; double unknown5 = unknown0 < 4 ? unknown2 : (unknown0 != 12 && unknown0 != 14 ? unknown3 : unknown1); return ((unknown0 & 1) == 0 ? unknown4 : -unknown4) + ...
6
public void playBlock(World var1, int var2, int var3, int var4, int var5, int var6) { float var7 = (float)Math.pow(2.0D, (double)(var6 - 12) / 12.0D); String var8 = "harp"; if(var5 == 1) { var8 = "bd"; } if(var5 == 2) { var8 = "snare"; } if(var5 == 3) { ...
4
private static Object wakeUpNaked(Class<?> c, Map<String,Object> data) { if (c == null) return null; Object returnObject; try { returnObject = c.newInstance(); } catch (Throwable e) { return null; } if (data != null && data.size() > 0) { fill(returnObject,data); } try { Method m = c.get...
7
private void setMonitor() { Timer timer = new Timer("Ganglia Monitor", true); timer.scheduleAtFixedRate(new TimerTask() { public void run() { updateCount++; synchronized (reportTasks) { try { InetAddress col = InetAddress.getByName(collector); for (StatReporter sr : reportTasks) { ...
2
public void setHealth(int health) { if (health == this.health) return; changes.add(ChangeType.HEALTH); if (health < 1) { health = BBServer.getConfig().getHealthCap(); setLocation(World.getRandomSpawnPoint()); // Broadcast that the player has been killed and has respawned return; } if (health > ...
4
@Override public boolean allow(FsNode node) { String value; if(field.equals("id")){ value = node.getId(); }else{ value = node.getProperty(field); } if(value != null){ if(!caseSensitive){ value = value.toLowerCase(); allowedValue = allowedValue.toLowerCase(); } if(trim){ ...
8
public boolean clearPathInFileBetween(Field from, Field to) { // Is horizontally path between fields clear? for (char rank='1'; rank<='8'; rank++) { if (this.rankBetween(rank, from.rank, to.rank) && this.getField(from.file, rank).hasPiece()) { return false; } } return true; }
3
public FileTransfer(String fileName, Long fileSizeLeft){ this.fileName = fileName; this.fileSizeLeft = fileSizeLeft; this.file = new File(this.fileName,""); try{ if(!this.file.exists()){ this.file.createNewFile(); } this.fileOutputStream = new FileOutputStream(file,true);// 追加模式写文件 this.fileCha...
2
@Override public boolean execute(SimpleTowns plugin, CommandSender sender, String commandLabel, String[] args) { final Localisation localisation = plugin.getLocalisation(); if (!(sender instanceof Player)) { sender.sendMessage(localisation.get(LocalisationEntry.ERR_PLAYER_ONLY_COMMAND))...
5
public void updateConnected(int frameNo) { switch (frameNo) { case 1: jCheckBox1.setSelected(true); break; case 2: jCheckBox2.setSelected(true); break; case 3: jCheckBox3.setSelected(true); ...
4
public static void appendProbs(Map<String, Vector<String> > map){ BufferedReader br = null; BufferedWriter bw = null; try { br = new BufferedReader(new InputStreamReader(new FileInputStream("problemType.txt"))); bw = new BufferedWriter(new OutputStreamWriter(new FileOutpu...
8
public static int[] primeFactor() { int[] arr = new int[21]; int temp; for (int i = 2; i <= 20; i++) { temp = i; for (int a = 2; a <= i; a++) { if (temp % a == 0) { for (int z = 1; z <= 20; z++) { if (temp % Math.pow(a, z) == 0) arr[a] = Math.max(arr[a], z); } } } } arr...
5
public static String padding(final int repeat, final char padChar) { if (repeat < 0) { throw new IndexOutOfBoundsException("Cannot pad a negative amount: " + repeat); } final char[] buf = new char[repeat]; for (int i = 0; i < buf.length; i++) { buf[i] = padChar; ...
2