Q:

Programming in Java bytecode example

i want to ask how i can write in bytecode, i need some example for sample things like make a function etc...
if someone can tell me how to write this code in bytecode i can mabey compare and learn from this.
how do i write this java code in bytecode ?
package Bytecode;

public class Main {

    public static void main(String[] args) {
        System.out.println(factorial(5));
    }

    public static int factorial(int value){
        if(value<=0 || value==1)
            return 1;

        return value*factorial(value-1);

    }
}

A:

You can check out Jasmin. From Wikipedia,
Some projects provide Java assemblers to enable writing Java bytecode by hand. Assembly code may be also generated by machine, for example by compiler targeting Java virtual machine. Notable Java assemblers include:
Jasmin, takes textual descriptions for Java classes, written in a simple assembly-like syntax using Java Virtual Machine instruction set and generates a Java class file.
Jamaica, a macro assembly language for the Java virtual machine. Java syntax is used for class or interface definition. Method bodies are specified using bytecode instructions.
Also you can see the byte code of ur class file using javap -c classname

