Posts

Showing posts from February, 2017

Understanding Java bytecode

Java bytecode Java bytecode is the instruction set of the Java virtual machine. Each bytecode is composed of one, or in some cases two bytes that represent the instruction (opcode), along with zero or more bytes for passing parameters. Of the 255 possible byte-long opcodes, as of 2015, 198 are in use (~78%), 54 are reserved for future use (~21%), and 3 instructions (~1%) are set aside as permanently unimplemented. The Java bytecode system does not directly support floating point operations beyond 32 bits, except indirectly via bytecodes that enable use of 64-bit and 80-bit intermediate IEEE floating point operations. Java machine level language outer: for ( int i = 2 ; i < 1000 ; i ++) { for ( int j = 2 ; j < i ; j ++) { if ( i % j == 0 ) continue outer ; } System . out . println ( i ); } A Java compiler might translate the Java code above into byte code as follows, assuming the above was put ...

What is difference between JDK, JRE and JVM?

JDK The Java Development Kit (JDK) is a software development environment used for developing Java applications. It contains JRE development tools. JRE Java Runtime Environment (JRE) is a software package that contains what is required to run a Java program. It includes a Java Virtual Machine implementation together with an implementation of the Java Class Library. JVM Java virtual machine (JVM) is an abstract computing machine that enables a computer to run a Java program. It converts Java byte code into machine language and executes it.

Tree traversal and height and depth Implementation

package DataStructure3; import java.util.ArrayList; import java.util.LinkedList; class Node<E> { E data; LinkedList<Node> next; int lebel; } public class TestTree { public static void main(String[] args) { Node root = new Node(); root.data = 1; root.lebel=1;    root = add(root, 1, 2);    root = add(root, 1, 3);    root = add(root, 1, 4);    root = add(root, 1, 5);    root = add(root, 2, 6);    root = add(root, 3, 7);    root = add(root, 4, 8);    root = add(root, 5, 9);    root = add(root, 5, 10);    root = add(root, 6, 11);    root = add(root, 7, 12);    root = add(root, 13, 1);  

Tree with N child Java implementation

Image
                                                          K- tree Implementation in java                                                           Tree  Pre-order  traversal package DataStructure3; import java.util.LinkedList; class Node<E> { E data; LinkedList<Node> next; } public class TestTree { public static void main(String[] args) { // TODO Auto-generated method stub /* * Node head=new Node(); head.data=1; *  * Node c1=new Node(); c1.data=2; *  * Node c2=new Node(); c2.data=21; LinkedList l=new LinkedList(); * l.add(c1); l.add(c2); head.next=l; *  * LinkedList l2=new LinkedList(); Node c3=new Node()...

Background image Problem

Solution for background Image problems in  Apple Mail 9 Outlook 2000 Outlook 2002 Outlook 2003 Outlook 2007 Outlook 2010 Outlook 2011 Outlook 2013 Outlook 2016  Thunderbird 45 Android 4.4 Gmail App Gmail App iPhone 5 iPhone 5s iPhone 6 iPhone 6s  iPhone 6s Plus iPad (Retina) iPad Mini AOL Mail G Suite Gmail Office 365 Outlook.com Yahoo! Mail 

Tree with One child - Implementation in Java

class Node { String name; Node child; } public class TreeTest { static Node add(Node x, String child) { if (x == null) { Node node = new Node(); node.name = child; x=node; return x; } if (x.child != null) { add(x.child, child); } else{ Node node = new Node(); node.name = child; x.child=node; } return x; }