Terms & Conditions | Disclaimer & Internet Privacy Statement© The Hongkong and Shanghai Banking Corporation Limited 2002-2016. All rights reserved.
It is my Computer Notes. Using Guide : object-key or object-key-key e.g. Step 1 Blog Search : [mysql-run] and then Step 2 ctrl+F [mysql-run] {bookMark me : Ctrl+D}
2016年2月24日 星期三
2016年2月7日 星期日
java-sort
source :
http://mathbits.com/MathBits/Java/arrays/SelectionSort.htm
| Array at beginning: | 84 | 69 | 76 | 86 | 94 | 91 |
| After Pass #1: | 84 | 91 | 76 | 86 | 94 | 69 |
| After Pass #2: | 84 | 91 | 94 | 86 | 76 | 69 |
| After Pass #3: | 86 | 91 | 94 | 84 | 76 | 69 |
| After Pass #4: | 94 | 91 | 86 | 84 | 76 | 69 |
| After Pass #5 (done): | 94 | 91 | 86 | 84 | 76 | 69 |
While being an easy sort to program, the selection sort is one of the least efficient. The algorithm offers no way to end the sort early, even if it begins with an already sorted list.
// Selection Sort Method for Descending Orderpublic static void SelectionSort ( int [ ] num )
|
Convert int[] into ArrayList
*****************************************
* String Array to Array List ******************
*****************************************
http://www.tutorialspoint.com/java/util/arrays_aslist.htm
Example
The following example shows the usage of java.util.Arrays.asList() method.
package com.tutorialspoint; import java.util.Arrays; import java.util.List; public class ArrayDemo1 { public static void main (String args[]) { // create an array of strings String a[] = new String[]{"abc","klm","xyz","pqr"}; List list1 = Arrays.asList(a); // printing the list System.out.println("The list is:" + list1); } }
Let us compile and run the above program, this will produce the following result:
The list is:[abc, klm, xyz, pqr]
http://stackoverflow.com/questions/10530353/convert-string-array-to-arraylist
import java.util.Arrays;
import java.util.List;
import java.util.ArrayList;
public class StringArrayTest
{
public static void main(String[] args)
{
String[] words = {"ace", "boom", "crew", "dog", "eon"};
List<String> wordList = Arrays.asList(words);
for (String e : wordList)
{
System.out.println(e);
}
}
}
**********************************
* Array List to string array ************
**********************************
List<String> stockList = new ArrayList<String>();
stockList.add("stock1");
stockList.add("stock2");
String[] stockArr = new String[stockList.size()];
stockArr = stockList.toArray(stockArr);
for(String s : stockArr)
System.out.println(s);
****************************************************************
************** Array List to Integer * *******************************
****************************************************************
http://www.tutorialspoint.com/java/util/arraylist_get.htm
Example
The following example shows the usage of java.util.ArrayList.get() method.
package com.tutorialspoint; import java.util.ArrayList; public class ArrayListDemo { public static void main(String[] args) { // create an empty array list with an initial capacity ArrayList<Integer> arrlist = new ArrayList<Integer>(5); // use add() method to add elements in the list arrlist.add(15); arrlist.add(22); arrlist.add(30); arrlist.add(40); // let us print all the elements available in list for (Integer number : arrlist) { System.out.println("Number = " + number); } // retrieves element at 4th postion int retval=arrlist.get(3); System.out.println("Retrieved element is = " + retval); } }
Let us compile and run the above program, this will produce the following result:
Number = 15 Number = 22 Number = 30 Number = 40 Retrieved element is = 40
***********************************************************
* int list to int[] *********************************************
***********************************************************
https://www.blogger.com/blogger.g?blogID=5452307390516932808#editor/target=post;postID=4395252080140059040
private int[] buildIntArray(List<Integer> integers) {
int[] ints = new int[integers.size()];
int i = 0;
for (Integer n : integers) {
ints[i++] = n;
}
return ints;
}
http://stackoverflow.com/questions/10269300/convert-int-into-arraylist
List<Integer> list = Arrays.asList(1, 2, 3);
So something along the lines of:
int[] array = { 1, 2, 3 };
ArrayList<Integer> list = new ArrayList<Integer>(array.length);
for (int i = 0; i < array.length; i++)
list.add(Integer.valueOf(array[i]));
2016年1月7日 星期四
bootstrap househk rental
https://www.dropbox.com/s/vrnhjq1mlxm81wu/Course_Files.zip course download
http://www.picresize.com/# resize jpg
https://scotch.io/bar-talk/bootstrap-3-tips-and-tricks-you-might-not-know#don’t-forget-container-fluid-for-full-width-rows bootstrap tips
http://codepen.io/jakestuts/pen/tGpju table
https://www.youtube.com/watch?v=5mgsQ2csCIU Less
http://plugins.krajee.com/file-basic-usage-demo upload files with preview
https://datatables.net/examples/styling/bootstrap.html
http://rent.591.com.hk/?did=51
http://p18.on.cc/listing/index.html
http://www.tutorialrepublic.com/twitter-bootstrap-tutorial/bootstrap-get-started.php tutorial
http://startbootstrap.com/template-categories/all/ menu
http://getbootstrap.com/css/ tutorial
https://www.youtube.com/watch?v=ZGotwBWGL7A introduce
https://www.youtube.com/watch?v=oepmLGQP1m4&list=PLUoqTnNH-2Xz_BUrjcahKWDhPcUj-FTOt&index=3 tutorial 26
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- Bootstrap -->
<link href="css/bootstrap.min.css" rel="stylesheet">
<!-- your layout style -->
<link href="css/style.css" rel="stylesheet">
</head>
<body>
<h1>Hello, world!</h1>
<!-- Js in bottom so the DOM will laod Faster-->
<script src="js/jquery.min.js"></script>
<script src="js/bootstrap.min.js"></script>
</body>
</html>
訂閱:
文章 (Atom)

