anyone willing to look over my code? (java)

anyone willing to look over my code? (java)

package inorder.without.cheats;

import java.util.Arrays; import javax.swing.JOptionPane;

public class InOrderWithOutCheats {

    public static void main(String[] args) {


            int howManyNumbers = Integer.parseInt 
                    (JOptionPane.showInputDialog
                    (null, "how many numbers would you like to chose?"));
            //gets number of numbers, stores number in "howManyNumbers"


            if (howManyNumbers <= 0){JOptionPane.showMessageDialog 
                    (null, "You Must Enter A Positive Number Greater "
                    + "Than 0!", "Hey!", JOptionPane.ERROR_MESSAGE);
            }
            // prevents "howManyNumbers" from being <= 0


            int[] array = new int[howManyNumbers];

            int i = 1;

            while (i <= howManyNumbers){

                    int choseNumber = Integer.parseInt 
                            (JOptionPane.showInputDialog 
                            (null, "Number #" + i));

                    i = i -1;

                    array[i] = choseNumber;

                    i = i + 2;
            }
            // assigns the chosen numbers to array "array"


            int largest = array[0];

            for(int z = 0; z < array.length; z++){

                    if(array[z] > largest){

                            largest = array[z];
                    }
            }
            // finds the largest number in "array" and puts it in "largest"


            int[] array2 = new int[array.length];

            for (int k = 0; k <= largest; k++){

                    for (int a = 0; a <= array.length; a++){

                            if (k == array[a]){

                                    for (int b = 0; b < array.length; b++){

                                            if (b == 0){

                                                    k = array2[b];
                                            }
                                    }
                            }
                    }
            }
            /*
            * wrote this bit myself, it would be nice if it went through the array 
            * and re arranged them numerically into "array2"
            */

            JOptionPane.showMessageDialog (null, Arrays.toString(array2));
            /*
            * and finnaly, this should give you the numbers you first entered, 
            * but in order from least to greatest.
            */


    }

}

View Answers









Related Tutorials/Questions & Answers:
anyone willing to look over my code? (java)
java code7 of 1
Advertisements
hello. can anyone help me with my java project, using jcreator?
ModuleNotFoundError: No module named 'codel'
plz anyone can solve my
ModuleNotFoundError: No module named 'codep'
ModuleNotFoundError: No module named 'codep'
ModuleNotFoundError: No module named 'codep'
ModuleNotFoundError: No module named 'codev'
ModuleNotFoundError: No module named 'codex'
ModuleNotFoundError: No module named 'codex'
what is wrong with my JSP codes for updating a form?
java codes
java codes
ModuleNotFoundError: No module named 'codeq-nlp-api'
ModuleNotFoundError: No module named 'codev-dashboard'
ModuleNotFoundError: No module named 'codev-dashboard'
Technologies in Java EE 6
ModuleNotFoundError: No module named 'codex-africanus'
ModuleNotFoundError: No module named 'codex-africanus'
ModuleNotFoundError: No module named 'codet-ari'
ModuleNotFoundError: No module named 'codet-ari'
ModuleNotFoundError: No module named 'codet-ari'
ModuleNotFoundError: No module named 'codet-ari'
ModuleNotFoundError: No module named 'codet-swaggerpy'
look up tables in java
ModuleNotFoundError: No module named 'coder'
ModuleNotFoundError: No module named 'coder'
NAME SORTING. . .anyone? - Java Beginners
java codes - Java Beginners
Maven dependency for com.intersult - coder version 1.5 is released. Learn to use coder version 1.5 in Maven based Java projects
java sorting codes - Java Beginners
JAVA CODES - Java Beginners
Java Codes - Java Beginners
Java codes - Java Beginners
Java Example Codes and Tutorials in 2017
Key features in Java EE 6
ModuleNotFoundError: No module named 'coded_exceptions'
ModuleNotFoundError: No module named 'coded_exceptions'
ModuleNotFoundError: No module named 'bdd-coder'
ModuleNotFoundError: No module named 'live-coder'
ModuleNotFoundError: No module named 'range-coder'
ModuleNotFoundError: No module named 'bdd-coder'
Coder for Pattern
Media Coder
Can u Look to the error plz - Java Beginners
Java Question Anyone need some HELP !!
ModuleNotFoundError: No module named 'cw_msgpack_coder'
Version of com.intersult>coder dependency
I need to launch multiple browsers installed on another windows M/C from my windows M/C over the network.

Ads