15,895,462 members
Sign in
Sign in
Email
Password
Forgot your password?
Sign in with
home
articles
Browse Topics
>
Latest Articles
Top Articles
Posting/Update Guidelines
Article Help Forum
Submit an article or tip
Import GitHub Project
Import your Blog
quick answers
Q&A
Ask a Question
View Unanswered Questions
View All Questions
View C# questions
View C++ questions
View Javascript questions
View Visual Basic questions
View Python questions
discussions
forums
CodeProject.AI Server
All Message Boards...
Application Lifecycle
>
Running a Business
Sales / Marketing
Collaboration / Beta Testing
Work Issues
Design and Architecture
Artificial Intelligence
ASP.NET
JavaScript
Internet of Things
C / C++ / MFC
>
ATL / WTL / STL
Managed C++/CLI
C#
Free Tools
Objective-C and Swift
Database
Hardware & Devices
>
System Admin
Hosting and Servers
Java
Linux Programming
Python
.NET (Core and Framework)
Android
iOS
Mobile
WPF
Visual Basic
Web Development
Site Bugs / Suggestions
Spam and Abuse Watch
features
features
Competitions
News
The Insider Newsletter
The Daily Build Newsletter
Newsletter archive
Surveys
CodeProject Stuff
community
lounge
Who's Who
Most Valuable Professionals
The Lounge
The CodeProject Blog
Where I Am: Member Photos
The Insider News
The Weird & The Wonderful
help
?
What is 'CodeProject'?
General FAQ
Ask a Question
Bugs and Suggestions
Article Help Forum
About Us
Search within:
Articles
Quick Answers
Messages
Comments by ramki48 (Top 4 by date)
ramki48
21-Jun-15 7:51am
View
//import java.awt.List;
import java.util.LinkedList;
import java.util.List;
import java.util.Scanner;
public class Question3 {
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
System.out.println("Enter size of array \n");
int n=scan.nextInt();
String numbers[]=new String[n];
String temp[]=new String[n];
String finalarray[]=new String[n];
System.out.println("Enter "+n+" array items \n");
for(int i = 0;i<n;i++)
="" {
="" string="" token="scan.next();
numbers[i]=" token;
="" }
="" vartemp="null;" while(temp!="null" &&="" temp.length="">0)
{
int i=0;
int maxnoindex= getMaxNoIndex(numbers);
int minnoindex= getMinNoIndex(numbers);
finalarray=insertElement(finalarray,i,numbers[minnoindex]);
finalarray=insertElement(finalarray,i+1,numbers[maxnoindex]);
vartemp=numbers[minnoindex];
temp=removeElements(temp, vartemp);
vartemp=numbers[maxnoindex];
temp=removeElements(temp,vartemp);
i++;
}
}
public static String[] removeElements(String[] input, String deleteMe) {
List result = new LinkedList();
for(String item : input)
if(!deleteMe.equals(item))
result.add(item);
return (String[]) result.toArray(input);
}
public static int getMaxNoIndex(String modetracker[])
{
int maxIndex = 0;
for (int i = 1; i < modetracker.length; i++){
Object number = modetracker[i];
int newnumber=(int) number;
if ((newnumber > modetracker[maxIndex])){
maxIndex = i;
}
}
return maxIndex;
}
public static int getMinNoIndex(String modetracker[])
{
int minIndex = 0;
for (int i = 1; i < modetracker.length; i++){
int newnumber = modetracker[i];
if ((newnumber < modetracker[minIndex])){
minIndex = i;
}
}
return minIndex;
}
private static int[] insertElement(int original[],
int element, int index) {
int length = original.length;
int destination[] = new int[length + 1];
System.arraycopy(original, 0, destination, 0, index);
destination[index] = element;
System.arraycopy(original, index, destination, index
+ 1, length - index);
return destination;
}
}
ramki48
2-Apr-14 1:21am
View
Sergey Alexandrovich Kryukov,
My problem is to log the incoming requests to my method wether it is success or a exception? I need sugetion where to place my code?
regards,
RK
ramki48
10-Jan-14 6:58am
View
yep Can we do postback in showmodeldialog().
ramki48
10-Jan-14 5:55am
View
It is opening in new window when I do operations on gridview. When I click on button on footer it should update in data base and rebind. It is prefoming all the operations but it is showing new grid afer binding in new windiow like window.open().but my model dialog is not postbacking...