Sponsored Content
Top Forums Shell Programming and Scripting Java - Arrays.binarySearch function equivalent in awk Post 302853065 by Akshay Hegde on Friday 13th of September 2013 05:15:05 AM
Old 09-13-2013
Java - Arrays.binarySearch function equivalent in awk

Hi all

Does anyone know Java-Arrays.binarySearch function equivalent in awk
I tried like this but it's not correct one,it just returns array index if and only when searched value available in array, for some reason if searched value not found then I want to return upper nearest neighbour index. please let me know if anyone have better idea

Code:
function Arrays_binarySearch(arr,val){
                    
                    for(b in arr){
                    if(arr[b]==val)
                             return b
                             break
                             }    
                    
                     }

here is link to example in java

Java.util.Arrays.binarySearch(int[] a, int key) Method Example

please someone help me..

Last edited by Akshay Hegde; 09-13-2013 at 12:49 PM..
 

10 More Discussions You Might Find Interesting

1. Linux

Equivalent function of [ kbhit() ] In TURBO C

ANy one knows equivalent function of which in Turbo C. I want to Execute Certain loop until any key is pressed. i.e while(!kbhit) { ---------- ---------- } This code work fine in DOS but NOt in LINUX i try to use but not getting the expected result ... (0 Replies)
Discussion started by: niravuchat
0 Replies

2. HP-UX

create thread C with JNI function with JAVA

Hello, J create a thread C with a JNI function via JAVA. J have the following message (but not in each time): Someone has an idea ? Thank. Unexpected Signal : 4 occurred at PC=0x78C103E0 Function= Library=(N/A) NOTE: We are unable to locate the function name... (0 Replies)
Discussion started by: AUBERT
0 Replies

3. Shell Programming and Scripting

shell: creating different arrays based on function argument

hi, I was wondering if there was a good way to create an array within a function, where the name is based on a passed argument? I tried this: _____________________________ func(){ #take in 1st arg as the arrayname arrayName=$1 let i=0 while read line do arrayName=${line} let i+=1... (5 Replies)
Discussion started by: nix21
5 Replies

4. Programming

equivalent function for wherey( ) ??

what is the equivalent function for wherey( ) ?? That is to return the current column position? (2 Replies)
Discussion started by: rockgal
2 Replies

5. Shell Programming and Scripting

Bash equivalent of perl's pack function ?

Is there an equivalent of perl's pack function in bash ? Or in other words, how can I achieve the same thing in bash ? Much appreciated. (1 Reply)
Discussion started by: NewDeb
1 Replies

6. Shell Programming and Scripting

shell script equivalent for tcl function

Hello, I need experts help in converting the below tcl function to korn shell function equivalent. proc lsNetMaskToBits {mask} { set dw ; # Top N bits set set dw 0x ; # Make sure it's hexadecimal, else XOR fails. puts "lsNetMaskToBits dw $dw" set dw ; # Complement => low 32-N bits... (1 Reply)
Discussion started by: JackMelson
1 Replies

7. Programming

Equivalent function for matlab on scilab

Hello everyone, i need help with this , i need the equivalent matlab funtion tf(x,y) in scilab and what do u recommend best from those three for a linux user (i need it for Control theory): 1-matlab 2-Scilab 3-Octave thank you for your time (0 Replies)
Discussion started by: abu_malek
0 Replies

8. Shell Programming and Scripting

Recursive function and arrays

I have the following function in a bash script that fails to return the sorted array. I think the problem lies in the recursion not correctly passing the arrays, but I can't tell what I'm doing wrong. Anyone see the problem? function quicksort () { local array=( `echo "$1"` ) local... (7 Replies)
Discussion started by: tkg
7 Replies

9. Programming

STL algorithm merge() function to concatenate char arrays

When the STL generic algorithm's merge() function is used to merge two char arrays, the output is not as expected. Below is the program I tried with. #include <iostream> #include <algorithm> #include <cstring> #include <deque> #include <iterator> using namespace std; int main() { ... (3 Replies)
Discussion started by: royalibrahim
3 Replies

10. UNIX for Dummies Questions & Answers

Shell equivalent of matlab fwrite function

I have some matlab code that sends the serial port elements of an array using matlab's fwrite function, e.g.: fwrite(s, , 'uchar'); What would be a unix shell equivalent? E.g., after successfully accessing the port using instructions here: Simple terminal serial port program for Linux/MacOSX... (3 Replies)
Discussion started by: darwin_886
3 Replies
jvisualvm(1)						      General Commands Manual						      jvisualvm(1)

NAME
jvisualvm - Java Virtual Machine Monitoring, Troubleshooting, and Profiling Tool SYNOPSIS
jvisualvm [ options ] PARAMETERS
Options, if used, should follow immediately after the command name. Options may be in any order. For a discussion of parameters that apply to a specific option, see OPTIONS below. DESCRIPTION
Java VisualVM is an intuitive graphical user interface that provides detailed information about Java technology-based applications (Java applications) while they are running on a given Java Virtual Machine (JVM(*)). The name Java VisualVM comes from the fact that Java Visu- alVM provides information about the JVM software visually. Java VisualVM combines several monitoring, troubleshooting, and profiling utilities into a single tool. For example, most of the function- ality offered by the standalone tools jmap, jinfo, jstat and jstack have been integrated into Java VisualVM. Other functionalities, such as some of those offered by the JConsole tool, can be added as optional plug-ins. OPTIONS
The following option is possible when you launch Java VisualVM. -J<jvm_option> Pass this <jvm_option> to the JVM software. USAGE
Java VisualVM is useful to Java application developers to troubleshoot applications and to monitor and improve the applications' perfor- mance. Java VisualVM can allow developers to generate and analyse heap dumps, track down memory leaks, perform and monitor garbage collec- tion, and perform lightweight memory and CPU profiling. Plug-ins also exist that expand the functionality of Java VisualVM. For example, most of the functionality of the JConsole tool is available via the MBeans Tab and JConsole Plug-in Wrapper plug-ins. You can choose from a catalog of standard Java VisualVM plug-ins by selecting 'Tools' | 'Plugins' in the Java VisualVM menus. Start Java VisualVM with the following command: % jvisualvm <options> SEE ALSO
For more details about Java VisualVM see the following pages. o Java VisualVM developers' site @ https://visualvm.dev.java.net o Java VisualVM in Java SE platform documentation @ http://java.sun.com/javase/6/docs/technotes/guides/visualvm/index.html (* The terms "Java Virtual Machine" and "JVM" mean a Virtual Machine for the Java platform.) 26 Mar 2008 jvisualvm(1)
All times are GMT -4. The time now is 12:55 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy