return new Numbers(context.getLocale());
// ... for (var i=0; i<100; i++) { var numbers = new Numbers(); // ...
Numbers n = new Numbers(new int[]{1,2,3}); for (int i : n) System.out.println(i); // or anything else
Numbers n = new Numbers(); Class cl = n.getClass();
Numbers obj=new Numbers(); obj.max( a, b, c,d ,e);
Numbers instance = new Numbers(); int maxValue = instance.max(1, 2, 3, 4, 5);
public class DistinctNumbersInStrings { public static Numbers[] distinctNumbersInStrings(String str){ String[] splitArray = str.split(" "); Numbers[] number = new Numbers[splitArray.length]; for (int i = 0; i < splitArray.length; i++){ number[i] = new Numbers(splitArray[i]); } return number; } public static void main(String[] args){ Numbers[] number = distinctNumbersInStrings("99 88 77 66 55 44 33 22 11"); Vector<String> v = new Vector<String>(); for(Numbers n : number){ v.addElement(n.num); } System.out.print(v); } }
Numbers n = new Numbers(); int minimum = n.min(10,20,30,40,50); System.out.println(minimum); // Prints 10 int maximum = n.max(10,20,30,40,50); System.out.println(maximum); // Prints 50 double average = n.avg(10,20,30,40,50); System.out.println(average); // Prints 30 double dev = n.devstd(10,20,30,40,50);
public Main{ public static void main( String[] args ){ Numbers numbers = new Numbers(); // Instance int minimum = numbers.min( 1, 2, 3, 4, 5 ); System.out.println( "minimum:" + minimum ); int maximum = numbers.max( 1, 2, 3, 4, 5); System.out.println("maximum:" + maximum ); double average = numbers.avg( 1, 2, 3, 4, 5 ); System.out.println("average:" + average ); double standardDev = numbers.devstd( 1, 2, 3, 4, 5 ); System.out.println("standard deviation:" + standardDev ); } }
// dis is been initialised BEFORE nus Disp dis = new Disp(); Funk fun = new Funk(); Numbers nus = new Numbers();
Numbers nus = new Numbers(); Disp dis = new Disp(); Funk fun = new Funk();
public static void main(String args[]) { Numbers numbers = new Numbers(); numbers.setAge(); } private boolean alrearyAsked = false; private int age = 0; static Scanner scan = new Scanner(System.in); public void setAge() { try { age = scan.nextInt(); } catch (NumberFormatException e) { if (alrearyAsked) { System.out.println("you typed a wrong age, please try again."); } else { System.out.println("What is your age?"); } this.setAge(); } }
public void printTicket() { Numbers method = new Numbers(); method.generateNumbers(); method.orderNumbers(); method.printNumbers(); }
private static Map<String,Object> buildExpressionEvaluationUtilityObjects(final Locale locale) { Map<String,Object> objects = EXPRESSION_EVALUATION_UTILITY_OBJECTS_BY_LOCALE.get(locale); if (objects == null) { objects = new HashMap<String, Object>(30); if (locale != null) { objects.put(StandardExpressionObjectFactory.CALENDARS_EXPRESSION_OBJECT_NAME, new Calendars(locale)); objects.put(StandardExpressionObjectFactory.DATES_EXPRESSION_OBJECT_NAME, new Dates(locale)); objects.put(StandardExpressionObjectFactory.NUMBERS_EXPRESSION_OBJECT_NAME, new Numbers(locale)); objects.put(StandardExpressionObjectFactory.STRINGS_EXPRESSION_OBJECT_NAME, new Strings(locale)); } objects.put(StandardExpressionObjectFactory.BOOLS_EXPRESSION_OBJECT_NAME, new Bools()); objects.put(StandardExpressionObjectFactory.OBJECTS_EXPRESSION_OBJECT_NAME, new Objects()); objects.put(StandardExpressionObjectFactory.ARRAYS_EXPRESSION_OBJECT_NAME, new Arrays()); objects.put(StandardExpressionObjectFactory.LISTS_EXPRESSION_OBJECT_NAME, new Lists()); objects.put(StandardExpressionObjectFactory.SETS_EXPRESSION_OBJECT_NAME, new Sets()); objects.put(StandardExpressionObjectFactory.MAPS_EXPRESSION_OBJECT_NAME, new Maps()); objects.put(StandardExpressionObjectFactory.AGGREGATES_EXPRESSION_OBJECT_NAME, new Aggregates()); EXPRESSION_EVALUATION_UTILITY_OBJECTS_BY_LOCALE.put(locale, objects); } return new HashMap<String, Object>(objects); }
private static Map<String,Object> buildExpressionEvaluationUtilityObjects(final Locale locale) { Map<String,Object> objects = EXPRESSION_EVALUATION_UTILITY_OBJECTS_BY_LOCALE.get(locale); if (objects == null) { objects = new HashMap<String, Object>(30); if (locale != null) { objects.put(StandardExpressionObjectFactory.CALENDARS_EXPRESSION_OBJECT_NAME, new Calendars(locale)); objects.put(StandardExpressionObjectFactory.DATES_EXPRESSION_OBJECT_NAME, new Dates(locale)); objects.put(StandardExpressionObjectFactory.NUMBERS_EXPRESSION_OBJECT_NAME, new Numbers(locale)); objects.put(StandardExpressionObjectFactory.STRINGS_EXPRESSION_OBJECT_NAME, new Strings(locale)); } objects.put(StandardExpressionObjectFactory.BOOLS_EXPRESSION_OBJECT_NAME, new Bools()); objects.put(StandardExpressionObjectFactory.OBJECTS_EXPRESSION_OBJECT_NAME, new Objects()); objects.put(StandardExpressionObjectFactory.ARRAYS_EXPRESSION_OBJECT_NAME, new Arrays()); objects.put(StandardExpressionObjectFactory.LISTS_EXPRESSION_OBJECT_NAME, new Lists()); objects.put(StandardExpressionObjectFactory.SETS_EXPRESSION_OBJECT_NAME, new Sets()); objects.put(StandardExpressionObjectFactory.MAPS_EXPRESSION_OBJECT_NAME, new Maps()); objects.put(StandardExpressionObjectFactory.AGGREGATES_EXPRESSION_OBJECT_NAME, new Aggregates()); EXPRESSION_EVALUATION_UTILITY_OBJECTS_BY_LOCALE.put(locale, objects); } return new HashMap<String, Object>(objects); }
private static Map<String,Object> computeBaseObjectsByLocale(final Locale locale) { Map<String,Object> objects = BASE_OBJECTS_BY_LOCALE_CACHE.get(locale); if (objects == null) { objects = new HashMap<String, Object>(15); if (locale != null) { objects.put(CALENDARS_EVALUATION_VARIABLE_NAME, new Calendars(locale)); objects.put(DATES_EVALUATION_VARIABLE_NAME, new Dates(locale)); objects.put(NUMBERS_EVALUATION_VARIABLE_NAME, new Numbers(locale)); objects.put(STRINGS_EVALUATION_VARIABLE_NAME, new Strings(locale)); } objects.put(BOOLS_EVALUATION_VARIABLE_NAME, new Bools()); objects.put(OBJECTS_EVALUATION_VARIABLE_NAME, new Objects()); objects.put(ARRAYS_EVALUATION_VARIABLE_NAME, new Arrays()); objects.put(LISTS_EVALUATION_VARIABLE_NAME, new Lists()); objects.put(SETS_EVALUATION_VARIABLE_NAME, new Sets()); objects.put(MAPS_EVALUATION_VARIABLE_NAME, new Maps()); objects.put(AGGREGATES_EVALUATION_VARIABLE_NAME, new Aggregates()); BASE_OBJECTS_BY_LOCALE_CACHE.put(locale, objects); } return objects; }